Browse Source

stopped thread handles from on win32

tags/2021-05-28
jules 18 years ago
parent
commit
9afbc31daf
2 changed files with 23 additions and 2 deletions
  1. +16
    -2
      build/win32/platform_specific_code/juce_win32_Threads.cpp
  2. +7
    -0
      src/juce_core/threads/juce_Thread.cpp

+ 16
- 2
build/win32/platform_specific_code/juce_win32_Threads.cpp 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()


+ 7
- 0
src/juce_core/threads/juce_Thread.cpp 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;
}


Loading…
Cancel
Save