1
0
Fork 0
mirror of https://github.com/juce-framework/JUCE.git synced 2026-01-10 23:44:24 +00:00

stopped thread handles from on win32

This commit is contained in:
jules 2007-08-07 09:32:16 +00:00
parent 50b3eb2394
commit 9afbc31daf
2 changed files with 23 additions and 2 deletions

View file

@ -91,7 +91,11 @@ void CriticalSection::exit() const throw()
//==============================================================================
WaitableEvent::WaitableEvent() throw()
#ifdef JUCE_DEBUG
: internal (CreateEvent (0, FALSE, FALSE, _T("Juce WaitableEvent")))
#else
: internal (CreateEvent (0, FALSE, FALSE, 0))
#endif
{
}
@ -125,10 +129,15 @@ static unsigned int __stdcall threadEntryProc (void* userData) throw()
juce_threadEntryPoint (userData);
_endthread();
_endthreadex(0);
return 0;
}
void juce_CloseThreadHandle (void* handle) throw()
{
CloseHandle ((HANDLE) handle);
}
void* juce_createThread (void* userData) throw()
{
unsigned int threadId;
@ -217,7 +226,12 @@ static HANDLE sleepEvent = 0;
void juce_initialiseThreadEvents() throw()
{
sleepEvent = CreateEvent (0, 0, 0, 0);
if (sleepEvent == 0)
#ifdef JUCE_DEBUG
sleepEvent = CreateEvent (0, 0, 0, _T("Juce Sleep Event"));
#else
sleepEvent = CreateEvent (0, 0, 0, 0);
#endif
}
void Thread::yield() throw()

View file

@ -44,6 +44,9 @@ void* juce_createThread (void* userData) throw();
void juce_killThread (void* handle) throw();
void juce_setThreadPriority (void* handle, int priority) throw();
void juce_setCurrentThreadName (const String& name) throw();
#if JUCE_WIN32
void juce_CloseThreadHandle (void* handle) throw();
#endif
//==============================================================================
static VoidArray runningThreads (4);
@ -78,6 +81,10 @@ void Thread::threadEntryPoint (Thread* const thread) throw()
runningThreads.removeValue (thread);
runningThreadsLock.exit();
#if JUCE_WIN32
juce_CloseThreadHandle (thread->threadHandle_);
#endif
thread->threadHandle_ = 0;
thread->threadId_ = 0;
}