Browse Source

Correct crash bug when closing clients on Windows due to multi-threading synchronization issues.

git-svn-id: http://subversion.jackaudio.org/jack/jack2/trunk/jackmp@1235 0c269be4-1314-0410-8aa9-9f06e86f4224
tags/0.59
sletz 19 years ago
parent
commit
758a40d8fa
2 changed files with 112 additions and 68 deletions
  1. +20
    -19
      ChangeLog
  2. +92
    -49
      windows/JackWinThread.cpp

+ 20
- 19
ChangeLog View File

@@ -1,19 +1,20 @@
---------------------------
Jackdmp changes log
---------------------------

2006-09-11 Stephane Letz <letz@grame.fr>

* Handling of LoopBack driver only when really needed.

2006-09-06 Stephane Letz <letz@grame.fr>

* Correct coreaudio driver (input was not working since 0.55 version).

2006-09-04 Stephane Letz <letz@grame.fr>

* Correct Windows VC++ projects.

2006-09-03 Stephane Letz <letz@grame.fr>

* First import of version 0.58 code
---------------------------
Jackdmp changes log
---------------------------
2006-09-11 Stephane Letz <letz@grame.fr>
* Handling of LoopBack driver only when really needed.
* Correct crash bug when closing clients on Windows due to multi-threading synchronization issues.
2006-09-06 Stephane Letz <letz@grame.fr>
* Correct coreaudio driver (input was not working since 0.55 version).
2006-09-04 Stephane Letz <letz@grame.fr>
* Correct Windows VC++ projects.
2006-09-03 Stephane Letz <letz@grame.fr>
* First import of version 0.58 code

+ 92
- 49
windows/JackWinThread.cpp View File

@@ -68,55 +68,98 @@ JackWinThread::~JackWinThread()
CloseHandle(fEvent); CloseHandle(fEvent);
} }


int JackWinThread::Start()
{
fRunning = true;
StartSync():
}

int JackWinThread::StartSync()
{
DWORD id;

if (fRealTime) {

JackLog("Create RT thread\n");
fThread = CreateThread(NULL, 0, ThreadHandler, (void*)this, 0, &id);

if (fThread == NULL) {
jack_error("Cannot create thread error = %d", GetLastError());
return -1;
}

if (WaitForSingleObject(fEvent, 3000) != WAIT_OBJECT_0) { // wait 3 sec
jack_error("Thread has not started");
return -1;
}

if (!SetThreadPriority(fThread, THREAD_PRIORITY_TIME_CRITICAL)) {
jack_error("Cannot set priority class = %d", GetLastError());
return -1;
}

return 0;

} else {

JackLog("Create non RT thread\n");
fThread = CreateThread(NULL, 0, ThreadHandler, (void*)this, 0, &id);

if (fThread == NULL) {
jack_error("Cannot create thread error = %d", GetLastError());
return -1;
}

if (WaitForSingleObject(fEvent, 3000) != WAIT_OBJECT_0) { // wait 3 sec
jack_error("Thread has not started");
return -1;
}

return 0;
}
int JackWinThread::Start()
{
DWORD id;
fEvent = CreateEvent(NULL, FALSE, FALSE, NULL);
if (fEvent == NULL) {
jack_error("Cannot create event error = %d", GetLastError());
return -1;
}
fRunning = true;
if (fRealTime) {
JackLog("Create RT thread\n");
fThread = CreateThread(NULL, 0, ThreadHandler, (void*)this, 0, &id);
if (fThread == NULL) {
jack_error("Cannot create thread error = %d", GetLastError());
return -1;
}
if (!SetThreadPriority(fThread, THREAD_PRIORITY_TIME_CRITICAL)) {
jack_error("Cannot set priority class = %d", GetLastError());
return -1;
}
return 0;
} else {
JackLog("Create non RT thread\n");
fThread = CreateThread(NULL, 0, ThreadHandler, (void*)this, 0, &id);
if (fThread == NULL) {
jack_error("Cannot create thread error = %d", GetLastError());
return -1;
}
return 0;
}
}
int JackWinThread::StartSync()
{
DWORD id;
fEvent = CreateEvent(NULL, FALSE, FALSE, NULL);
if (fEvent == NULL) {
jack_error("Cannot create event error = %d", GetLastError());
return -1;
}
if (fRealTime) {
JackLog("Create RT thread\n");
fThread = CreateThread(NULL, 0, ThreadHandler, (void*)this, 0, &id);
if (fThread == NULL) {
jack_error("Cannot create thread error = %d", GetLastError());
return -1;
}
if (WaitForSingleObject(fEvent, 3000) != WAIT_OBJECT_0) { // wait 3 sec
jack_error("Thread has not started");
return -1;
}
if (!SetThreadPriority(fThread, THREAD_PRIORITY_TIME_CRITICAL)) {
jack_error("Cannot set priority class = %d", GetLastError());
return -1;
}
return 0;
} else {
JackLog("Create non RT thread\n");
fThread = CreateThread(NULL, 0, ThreadHandler, (void*)this, 0, &id);
if (fThread == NULL) {
jack_error("Cannot create thread error = %d", GetLastError());
return -1;
}
if (WaitForSingleObject(fEvent, 3000) != WAIT_OBJECT_0) { // wait 3 sec
jack_error("Thread has not started");
return -1;
}
return 0;
}
} }


// voir http://www.microsoft.com/belux/msdn/nl/community/columns/ldoc/multithread1.mspx // voir http://www.microsoft.com/belux/msdn/nl/community/columns/ldoc/multithread1.mspx


Loading…
Cancel
Save