浏览代码

Merged revisions 184-186 via svnmerge from
/trunk

git-svn-id: branches/fixes_2_0@188 -

Jonas Maebe 20 年之前
父节点
当前提交
92363129d3

+ 4 - 0
.gitattributes

@@ -3361,6 +3361,7 @@ rtl/darwin/Makefile -text
 rtl/darwin/Makefile.fpc svneol=native#text/plain
 rtl/darwin/console.pp svneol=native#text/plain
 rtl/darwin/errno.inc svneol=native#text/plain
+rtl/darwin/pmutext.inc svneol=native#text/plain
 rtl/darwin/powerpc/sig_cpu.inc svneol=native#text/plain
 rtl/darwin/powerpc/sighnd.inc svneol=native#text/plain
 rtl/darwin/pthread.inc svneol=native#text/plain
@@ -3405,6 +3406,7 @@ rtl/freebsd/i386/prt0.as -text
 rtl/freebsd/i386/sighnd.inc svneol=native#text/plain
 rtl/freebsd/i386/x86.inc svneol=native#text/plain
 rtl/freebsd/i386/x86h.inc svneol=native#text/plain
+rtl/freebsd/pmutext.inc svneol=native#text/plain
 rtl/freebsd/pthread.inc svneol=native#text/plain
 rtl/freebsd/ptypes.inc svneol=native#text/plain
 rtl/freebsd/signal.inc svneol=native#text/plain
@@ -3727,6 +3729,7 @@ rtl/netbsd/i386/cprt0.as -text
 rtl/netbsd/i386/prt0.as -text
 rtl/netbsd/i386/prt0_10.as -text
 rtl/netbsd/i386/sighnd.inc svneol=native#text/plain
+rtl/netbsd/pmutext.inc svneol=native#text/plain
 rtl/netbsd/powerpc/cprt0.as -text
 rtl/netbsd/powerpc/prt0.as -text
 rtl/netbsd/powerpc/sighnd.inc svneol=native#text/plain
@@ -3928,6 +3931,7 @@ rtl/openbsd/errno.inc svneol=native#text/plain
 rtl/openbsd/i386/cprt0.as -text
 rtl/openbsd/i386/prt0.as -text
 rtl/openbsd/i386/sighnd.inc svneol=native#text/plain
+rtl/openbsd/pmutext.inc svneol=native#text/plain
 rtl/openbsd/ptypes.inc svneol=native#text/plain
 rtl/openbsd/signal.inc svneol=native#text/plain
 rtl/openbsd/syscalls.inc svneol=native#text/plain

+ 8 - 11
rtl/bsd/sysosh.inc

@@ -19,20 +19,17 @@
 type
   { fd are int in C also for 64bit targets (x86_64) }
   THandle = Longint;
-  TThreadID = THandle;
+{$ifdef darwin}
+{$ifndef cpu64}
+  TThreadID = Longint;
+{$else cpu64}
+  TThreadID = int64;
+{$endif}
+{$endif darwin}
   
   { pthread_mutex_t }
   PRTLCriticalSection = ^TRTLCriticalSection;
-  TRTLCriticalSection = record
-    __m_reserved: longint;
-    __m_count: longint;
-    __m_owner: pointer;
-    __m_kind:  longint;
-    __m_lock:  record
-       __status: sizeint;
-      __spinlock: longint;
-    end;
-  end;
+  TRTLCriticalSection = {$i pmutext.inc}
 
 
 {

+ 18 - 0
rtl/darwin/pmutext.inc

@@ -0,0 +1,18 @@
+{
+    This file is part of the Free Pascal run time library.
+    Copyright (c) 1999-2000 by Peter Vreman
+    member of the Free Pascal development team.
+
+    See the file COPYING.FPC, included in this distribution,
+    for details about the copyright.
+
+    This program is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+
+ **********************************************************************}
+
+{ definition of pthread_mutex_t, because needed in both ptypes.inc and }
+{ in sysosh.inc                                                        }
+
+record sig: {$ifdef cpu64}int64{$else}longint{$endif}; opaque: array[0..40-1] of byte; end;

+ 1 - 1
rtl/darwin/ptypes.inc

@@ -154,7 +154,7 @@ type
 
    pthread_t            = pointer;
    pthread_attr_t       = record sig: clong; opaque: array[0..36-1] of byte; end;
-   pthread_mutex_t      = record sig: clong; opaque: array[0..40-1] of byte; end;
+   pthread_mutex_t      = {$i pmutext.inc}
    pthread_mutexattr_t  = record sig: clong; opaque: array[0..8-1] of byte; end;
    pthread_cond_t       = record sig: clong; opaque: array[0..24-1] of byte; end;
    pthread_condattr_t   = record sig: clong; opaque: array[0..4-1] of byte; end;

+ 18 - 0
rtl/freebsd/pmutext.inc

@@ -0,0 +1,18 @@
+{
+    This file is part of the Free Pascal run time library.
+    Copyright (c) 1999-2000 by Peter Vreman
+    member of the Free Pascal development team.
+
+    See the file COPYING.FPC, included in this distribution,
+    for details about the copyright.
+
+    This program is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+
+ **********************************************************************}
+
+{ definition of pthread_mutex_t, because needed in both ptypes.inc and }
+{ in sysosh.inc                                                        }
+
+pointer;

+ 1 - 1
rtl/freebsd/ptypes.inc

@@ -105,7 +105,7 @@ type
 
    pthread_t            = pointer;
    pthread_attr_t       = pointer;
-   pthread_mutex_t      = pointer;
+   pthread_mutex_t      = {$i pmutext.inc}
    pthread_mutexattr_t  = pointer;
    pthread_cond_t       = pointer;
    pthread_condattr_t   = pointer;

+ 18 - 0
rtl/netbsd/pmutext.inc

@@ -0,0 +1,18 @@
+{
+    This file is part of the Free Pascal run time library.
+    Copyright (c) 1999-2000 by Peter Vreman
+    member of the Free Pascal development team.
+
+    See the file COPYING.FPC, included in this distribution,
+    for details about the copyright.
+
+    This program is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+
+ **********************************************************************}
+
+{ definition of pthread_mutex_t, because needed in both ptypes.inc and }
+{ in sysosh.inc                                                        }
+
+pointer;

+ 1 - 1
rtl/netbsd/ptypes.inc

@@ -93,7 +93,7 @@ type
 
    pthread_t            = pointer;
    pthread_attr_t       = pointer;
-   pthread_mutex_t      = pointer;
+   pthread_mutex_t      = {$ pmutext.inc}
    pthread_mutexattr_t  = pointer;
    pthread_cond_t       = pointer;
    pthread_condattr_t   = pointer;

+ 18 - 0
rtl/openbsd/pmutext.inc

@@ -0,0 +1,18 @@
+{
+    This file is part of the Free Pascal run time library.
+    Copyright (c) 1999-2000 by Peter Vreman
+    member of the Free Pascal development team.
+
+    See the file COPYING.FPC, included in this distribution,
+    for details about the copyright.
+
+    This program is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+
+ **********************************************************************}
+
+{ definition of pthread_mutex_t, because needed in both ptypes.inc and }
+{ in sysosh.inc                                                        }
+
+pointer;

+ 1 - 1
rtl/openbsd/ptypes.inc

@@ -93,7 +93,7 @@ type
 
    pthread_t            = pointer;
    pthread_attr_t       = pointer;
-   pthread_mutex_t      = pointer;
+   pthread_mutex_t      = {$i pmutext.inc}
    pthread_mutexattr_t  = pointer;
    pthread_cond_t       = pointer;
    pthread_condattr_t   = pointer;

+ 1 - 1
rtl/unix/cthreads.pp

@@ -192,7 +192,7 @@ Type  PINTRTLEvent = ^TINTRTLEvent;
 {$endif DEBUG_MT}
         ThreadMain:=pointer(ti.f(ti.p));
         DoneThread;
-        pthread_detach(pthread_t(pthread_self()));
+        pthread_exit(nil);
       end;