diff options
author | blythe%netscape.com <devnull@localhost> | 2002-03-01 00:07:59 +0000 |
---|---|---|
committer | blythe%netscape.com <devnull@localhost> | 2002-03-01 00:07:59 +0000 |
commit | 09d50d85af5457fb7fc09261d941fa28a81e0529 (patch) | |
tree | 709eaccaaeca33be5d214e6fffb8ba80f7200bea | |
parent | 52602009018d695dfac903b19d9c47f3952cb22f (diff) | |
download | nspr-hg-09d50d85af5457fb7fc09261d941fa28a81e0529.tar.gz |
No CloseHandle on thread handles which were obtained via GetCurrentThreadId.
-rw-r--r-- | pr/include/md/_wince.h | 1 | ||||
-rw-r--r-- | pr/src/md/windows/w95thred.c | 10 |
2 files changed, 9 insertions, 2 deletions
diff --git a/pr/include/md/_wince.h b/pr/include/md/_wince.h index 02194c54..776e09bd 100644 --- a/pr/include/md/_wince.h +++ b/pr/include/md/_wince.h @@ -99,6 +99,7 @@ struct _MDThread { * wait queue of some cond var. * PR_FALSE otherwise. */ HANDLE handle; /* Win32 thread handle */ + PRBool noCloseHandle; /* Whether or not to CloseHandle */ PRUint32 id; void *sp; /* only valid when suspended */ PRUint32 magic; /* for debugging */ diff --git a/pr/src/md/windows/w95thred.c b/pr/src/md/windows/w95thred.c index d7c31df9..5c3826ba 100644 --- a/pr/src/md/windows/w95thred.c +++ b/pr/src/md/windows/w95thred.c @@ -104,6 +104,7 @@ _PR_MD_INIT_THREAD(PRThread *thread) ** On WinCE the thread ID is the same as the real thread handle. */ thread->md.handle = (HANDLE)GetCurrentThreadId(); + thread->md.noCloseHandle = PR_TRUE; #endif } @@ -217,8 +218,13 @@ _PR_MD_CLEAN_THREAD(PRThread *thread) } if (thread->md.handle) { - rv = CloseHandle(thread->md.handle); - PR_ASSERT(rv); + if(PR_FALSE == thread->md.noCloseHandle) { + rv = CloseHandle(thread->md.handle); + PR_ASSERT(rv); + } + else { + thread->md.noCloseHandle = PR_FALSE; /* reused? insurance.... */ + } thread->md.handle = 0; } } |