~ubuntu-branches/ubuntu/feisty/fpc/feisty

« back to all changes in this revision

Viewing changes to rtl/inc/thread.inc

  • Committer: Bazaar Package Importer
  • Author(s): Torsten Werner
  • Date: 2007-01-27 20:08:50 UTC
  • mfrom: (1.2.3 upstream)
  • Revision ID: james.westby@ubuntu.com-20070127200850-9mrptaqqjsx9nwa7
Tags: 2.0.4-5
* Fixed Build-Depends.
* Add myself to Uploaders in debian/control.
* Make sure that the sources are really patched before building them.
* Build unit 'libc' on powerpc too.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
{
2
 
    $Id: thread.inc,v 1.30 2005/04/20 07:41:48 hajny Exp $
3
2
    This file is part of the Free Pascal Run time library.
4
3
    Copyright (c) 2000 by the Free Pascal development team
5
4
 
22
21
                           Threadvar initialization
23
22
*****************************************************************************}
24
23
 
25
 
    procedure InitThread(stklen:cardinal);
 
24
    procedure InitThread(stklen:SizeUInt);
26
25
      begin
27
26
        SysResetFPU;
28
27
        { ExceptAddrStack and ExceptObjectStack are threadvars       }
33
32
        InOutRes:=0;
34
33
        // ErrNo:=0;
35
34
        { Stack checking }
36
 
        StackLength:=stklen;
 
35
        StackLength:= CheckInitialStkLen(stkLen);
37
36
        StackBottom:=Sptr - StackLength;
38
37
        ThreadID := CurrentTM.GetCurrentThreadID();
39
38
      end;
41
40
{*****************************************************************************
42
41
                            Overloaded functions
43
42
*****************************************************************************}
44
 
{$ifndef CPU64}
45
 
{$ifndef unix}
46
 
{$endif unix}
47
 
{$endif CPU64}
48
43
 
49
 
    function BeginThread(ThreadFunction : tthreadfunc) : DWord;
 
44
    function BeginThread(ThreadFunction : tthreadfunc) : TThreadID;
50
45
      var
51
46
        dummy : TThreadID;
52
47
      begin
54
49
      end;
55
50
 
56
51
 
57
 
    function BeginThread(ThreadFunction : tthreadfunc;p : pointer) : DWord;
 
52
    function BeginThread(ThreadFunction : tthreadfunc;p : pointer) : TThreadID;
58
53
      var
59
54
        dummy : TThreadID;
60
55
      begin
62
57
      end;
63
58
 
64
59
 
65
 
    function BeginThread(ThreadFunction : tthreadfunc;p : pointer;var ThreadId : TThreadID) : DWord;
 
60
    function BeginThread(ThreadFunction : tthreadfunc;p : pointer;var ThreadId : TThreadID) : TThreadID;
66
61
      begin
67
62
        BeginThread:=BeginThread(nil,DefaultStackSize,ThreadFunction,p,0,ThreadId);
68
63
      end;
69
64
 
70
 
 
71
 
{$ifndef CPU64}
72
 
{$ifndef unix}
73
 
{$endif unix}
74
 
{$endif CPU64}
 
65
    function BeginThread(ThreadFunction : tthreadfunc;p : pointer;
 
66
                     var ThreadId : TThreadID; const stacksize: SizeUInt) : TThreadID;
 
67
      begin
 
68
        BeginThread:=BeginThread(nil,stacksize,ThreadFunction,p,0,ThreadId);
 
69
      end;
75
70
 
76
71
    procedure EndThread;
77
72
      begin
78
73
        EndThread(0);
79
74
      end;
80
75
 
81
 
function BeginThread(sa : Pointer;stacksize : dword; ThreadFunction : tthreadfunc;p : pointer;creationFlags : dword;  var ThreadId : TThreadID) : DWord;
 
76
function BeginThread(sa : Pointer;stacksize : SizeUInt; ThreadFunction : tthreadfunc;p : pointer;creationFlags : dword;  var ThreadId : TThreadID) : TThreadID;
82
77
 
83
78
begin
84
79
  Result:=CurrentTM.BeginThread(sa,stacksize,threadfunction,P,creationflags,ThreadID);
292
287
  RunError(232)
293
288
end;
294
289
 
295
 
function NoBeginThread(sa : Pointer;stacksize : dword;
 
290
function NoBeginThread(sa : Pointer;stacksize : PtrUInt;
296
291
                     ThreadFunction : tthreadfunc;p : pointer;
297
 
                     creationFlags : dword; var ThreadId : TThreadID) : DWord;
 
292
                     creationFlags : dword; var ThreadId : TThreadID) : TThreadID;
298
293
begin
299
294
  NoThreadError;
300
295
end;
495
490
end;
496
491
{$endif DISABLE_NO_THREAD_MANAGER}
497
492
 
498
 
{
499
 
  $Log: thread.inc,v $
500
 
  Revision 1.30  2005/04/20 07:41:48  hajny
501
 
    * two more (TThreadID)
502
 
 
503
 
  Revision 1.29  2005/04/17 17:19:41  hajny
504
 
    * one more TThreadID fix
505
 
 
506
 
  Revision 1.28  2005/04/14 20:42:14  florian
507
 
    * fixed more TThreadID stuff
508
 
 
509
 
  Revision 1.27  2005/04/13 20:15:47  florian
510
 
    * TThread on linux fixed
511
 
 
512
 
  Revision 1.26  2005/04/09 17:26:08  florian
513
 
    + classes.mainthreadid is set now
514
 
    + rtleventresetevent
515
 
    + rtleventwairfor with timeout
516
 
    + checksynchronize with timeout
517
 
    * race condition in synchronize fixed
518
 
 
519
 
  Revision 1.25  2005/04/03 19:29:28  florian
520
 
    * proper error message if the cthreads unit is included too late
521
 
      uses clause
522
 
 
523
 
  Revision 1.24  2005/02/26 11:40:38  florian
524
 
    * rtl event init/destroy throws only an error if it's used in a mult threaded program
525
 
 
526
 
  Revision 1.23  2005/02/25 22:02:46  florian
527
 
    * another "transfer to linux"-commit
528
 
 
529
 
  Revision 1.22  2005/02/14 17:13:29  peter
530
 
    * truncate log
531
 
 
532
 
  Revision 1.21  2005/02/07 17:36:54  peter
533
 
  can't use resourcestrings in the system unit
534
 
 
535
 
  Revision 1.20  2005/02/06 11:20:52  peter
536
 
    * threading in system unit
537
 
    * removed systhrds unit
538
 
 
539
 
  Revision 1.19  2005/01/21 21:45:57  armin
540
 
  * applied patch to compile go32v2 from Tomas (tested by John)
541
 
 
542
 
  Revision 1.18  2005/01/16 14:46:57  florian
543
 
    * critical sections can be used in programs without threading driver, they have no effect then
544
 
 
545
 
}