Fixed deadlock that occured when quitting media applications.
I don't know why this never happened on R5. Haiku close_port() works as documented in BeBook, but might possibly different in R5. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@16629 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -433,18 +433,18 @@ void
|
|||||||
BMediaEventLooper::Quit()
|
BMediaEventLooper::Quit()
|
||||||
{
|
{
|
||||||
CALLED();
|
CALLED();
|
||||||
status_t err;
|
|
||||||
|
|
||||||
if (fRunState == B_TERMINATED)
|
if (fRunState == B_TERMINATED)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
SetRunState(B_QUITTING);
|
SetRunState(B_QUITTING);
|
||||||
|
write_port(ControlPort(), 0, NULL, 0); // null message to unblock the read (see BMediaNode::WaitForMessage)
|
||||||
close_port(ControlPort());
|
close_port(ControlPort());
|
||||||
if (fControlThread != -1)
|
if (fControlThread != -1) {
|
||||||
|
status_t err;
|
||||||
wait_for_thread(fControlThread, &err);
|
wait_for_thread(fControlThread, &err);
|
||||||
fControlThread = -1;
|
fControlThread = -1;
|
||||||
|
}
|
||||||
SetRunState(B_TERMINATED);
|
SetRunState(B_TERMINATED);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -359,6 +359,8 @@ BMediaNode::WaitForMessage(bigtime_t waitUntil,
|
|||||||
|
|
||||||
size = read_port_etc(ControlPort(), &message, data, sizeof(data), B_ABSOLUTE_TIMEOUT, waitUntil);
|
size = read_port_etc(ControlPort(), &message, data, sizeof(data), B_ABSOLUTE_TIMEOUT, waitUntil);
|
||||||
if (size <= 0) {
|
if (size <= 0) {
|
||||||
|
if (size == 0 && message == 0)
|
||||||
|
return B_OK; // a null message was received (to unblock the read)
|
||||||
if (size != B_TIMED_OUT)
|
if (size != B_TIMED_OUT)
|
||||||
ERROR("BMediaNode::WaitForMessage: read_port_etc error 0x%08lx\n",size);
|
ERROR("BMediaNode::WaitForMessage: read_port_etc error 0x%08lx\n",size);
|
||||||
return size; // returns the error code
|
return size; // returns the error code
|
||||||
|
|||||||
Reference in New Issue
Block a user