summaryrefslogtreecommitdiff
path: root/misc.c
diff options
context:
space:
mode:
authorrpj <rpj>1998-07-30 13:51:57 +0000
committerrpj <rpj>1998-07-30 13:51:57 +0000
commit94cfb27da3941eea2b20867eacc09a5b91168438 (patch)
treefaf0cfaab11409e9f4aa047f897dd82ca345ed56 /misc.c
parent96600f6d50eeeef1f660352b8455d4df1aed69ff (diff)
Thu Jul 30 23:12:45 1998 Ross Johnson <rpj@ixobrychus.canberra.edu.au>
* implement.h: Remove _pthread_find_entry() prototype. * private.c: Extend comments. Remove _pthread_find_entry() - no longer needed. * create.c (_pthread_start_call): Add call to TlsSetValue() to store the thread ID. * dll.c (PthreadsEntryPoint): Implement. This is called whenever a process loads the DLL. Used to initialise thread local storage. * implement.h: Add _pthread_threadID_TlsIndex. Add ()s around _PTHREAD_VALID expression. * misc.c (pthread_self): Re-implement using Win32 TLS to store the threads own ID.
Diffstat (limited to 'misc.c')
-rw-r--r--misc.c23
1 files changed, 8 insertions, 15 deletions
diff --git a/misc.c b/misc.c
index 9834630..ca39513 100644
--- a/misc.c
+++ b/misc.c
@@ -44,23 +44,16 @@ pthread_once(pthread_once_t *once_control,
pthread_t
pthread_self(void)
{
- /* It looks like a pthread_t needs to be a HANDLE, but Win32 also has
- another way of identifying threads: their thread id. We hope
- that all of the Win32 functions we are going to use only need
- HANDLEs. The morons. */
+ pthread_t ret;
+
+ ret = (pthread_t) TlsGetValue(_pthread_threadID_TlsIndex);
- /* FIXME: Need a new lookup method with the new thread allocation
- scheme.
-
- We can use the Win32 handle though as a basis (perhaps
- to look up a table) because pthread_self() will never be called
- after the Win32 thread has terminated (unless we can raise
- ourselves from the dead!), and therefore the Win32 handle cannot
- have been reused yet. */
+ if (ret == 0)
+ {
+ /* FIXME: Oh no! This can't happen. */
+ }
-#if 0
- return GetCurrentThread();
-#endif
+ return ret;
}
int