From a73382f7bbbb9164aee9ef0fb3ddffa968b88e7e Mon Sep 17 00:00:00 2001 From: Ingo Weinhold Date: Sun, 20 Dec 2009 00:31:37 +0000 Subject: [PATCH] * uninit_port_locked(): Fixed incorrect use of ConditionVariable::NotifyAll(). Fixes #5152. * _get_port_message_info_etc(): Check whether the port still exists and is not closed and empty in the loop. Though actually it shouldn't be necessary (same in the other functions), since Wait() would return an error, if the port was closed/deleted. Well, paranoia... :-) git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@34713 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/system/kernel/port.cpp | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/src/system/kernel/port.cpp b/src/system/kernel/port.cpp index 10a8dfe352..3c5253b0e1 100644 --- a/src/system/kernel/port.cpp +++ b/src/system/kernel/port.cpp @@ -579,8 +579,8 @@ uninit_port_locked(struct port_entry& port) // Release the threads that were blocking on this port. // read_port() will see the B_BAD_PORT_ID return value, and act accordingly - port.read_condition.NotifyAll(B_BAD_PORT_ID); - port.write_condition.NotifyAll(B_BAD_PORT_ID); + port.read_condition.NotifyAll(false, B_BAD_PORT_ID); + port.write_condition.NotifyAll(false, B_BAD_PORT_ID); sNotificationService.Notify(PORT_REMOVED, id); } @@ -1077,11 +1077,13 @@ _get_port_message_info_etc(port_id id, port_message_info* info, } locker.Lock(); - } - if (sPorts[slot].id != id) { - // the port is no longer there - return B_BAD_PORT_ID; + if (sPorts[slot].id != id + || (is_port_closed(slot) && sPorts[slot].messages.IsEmpty())) { + // the port is no longer there + T(Info(sPorts[slot], 0, B_BAD_PORT_ID)); + return B_BAD_PORT_ID; + } } // determine tail & get the length of the message