summaryrefslogtreecommitdiff
path: root/create.c
diff options
context:
space:
mode:
authorrpj <rpj>1999-08-19 05:26:02 +0000
committerrpj <rpj>1999-08-19 05:26:02 +0000
commit5e87a0d9bdd4c2c2ab0e45a6379b4df0f1471ffa (patch)
treec8b65744680e1ca884470f2f345b929e2abc4ff8 /create.c
parentb1972e47c0359b818522f6aa822f3457be938060 (diff)
1999-08-19 Ross Johnson <rpj@ixobrychus.canberra.edu.au>
* private.c (_pthread_threadStart): Return exit status from the application thread startup routine. - Milan Gardian <mg@tatramed.sk> 1999-08-18 Ross Johnson <rpj@ixobrychus.canberra.edu.au> * exit.c (pthread_exit): Put status into pthread_t->exitStatus - John Bossom <john.Bossom@cognos.com> * private.c (_pthread_threadStart): Set pthread->exitStatus on exit of try{} block. - John Bossom <john.Bossom@cognos.com> * sync.c (pthread_join): use pthread_exitStatus value if the thread exit doesn't return a value (for Mingw32 CRTDLL which uses endthread instead of _endthreadex). - John Bossom <john.Bossom@cognos.com> Tue Aug 17 20:17:58 CDT 1999 Mumit Khan <khan@xraylith.wisc.edu> * create.c (pthread_create): Add CRTDLL suppport. * exit.c (pthread_exit): Likewise. * private.c (_pthread_threadStart): Likewise. (_pthread_threadDestroy): Likewise. * sync.c (pthread_join): Likewise. * tests/join1.c (main): Warn about partial support for CRTDLL. Tue Aug 17 20:00:08 1999 Mumit Khan <khan@xraylith.wisc.edu> * Makefile.in (LD): Delete entry point. * acconfig.h (STDCALL): Delete unused macro. * configure.in: Remove test for STDCALL. * config.h.in: Regenerate. * errno.c (_errno): Fix self type. * pthread.h (PT_STDCALL): Move from here to * implement.h (PT_STDCALL): here. (_pthread_threadStart): Fix prototype. * private.c (_pthread_threadStart): Likewise. 1999-08-14 Ross Johnson <rpj@ixobrychus.canberra.edu.au> * exit.c (pthread_exit): Don't call pthread_self() but get thread handle directly from TSD for efficiency.
Diffstat (limited to 'create.c')
-rw-r--r--create.c23
1 files changed, 23 insertions, 0 deletions
diff --git a/create.c b/create.c
index e085179..426ad9a 100644
--- a/create.c
+++ b/create.c
@@ -125,6 +125,8 @@ pthread_create (pthread_t * tid,
: PThreadStateSuspended;
thread->keys = NULL;
+#if ! defined (__MINGW32__) || defined (__MSVCRT__)
+
thread->threadH = (HANDLE)
_beginthreadex (
(void *) NULL, /* No security info */
@@ -134,6 +136,27 @@ pthread_create (pthread_t * tid,
(unsigned) run ? 0 : CREATE_SUSPENDED,
(unsigned *) &(thread->thread));
+#else /* __MINGW32__ && ! __MSVCRT__ */
+
+ thread->threadH = (HANDLE)
+ _beginthread (
+ (void (*) (void *)) _pthread_threadStart,
+ (unsigned) stackSize, /* default stack size */
+ parms);
+
+ /* Make the return code to match _beginthreadex's. */
+ if (thread->threadH == (HANDLE)-1L)
+ thread->threadH = NULL;
+ else if (! run)
+ {
+ /* beginthread does not allow for create flags, so we do it now.
+ Note that beginthread itself creates the thread in SUSPENDED
+ mode, and then calls ResumeThread to start it. */
+ SuspendThread (thread->threadH);
+ }
+
+#endif /* __MINGW32__ && ! __MSVCRT__ */
+
result = (thread->threadH != 0) ? 0 : EAGAIN;
/*