* 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
This commit is contained in:
Ingo Weinhold 2009-12-20 00:31:37 +00:00
parent fc7d806ef9
commit a73382f7bb
1 changed files with 8 additions and 6 deletions

View File

@ -579,8 +579,8 @@ uninit_port_locked(struct port_entry& port)
// Release the threads that were blocking on this port. // Release the threads that were blocking on this port.
// read_port() will see the B_BAD_PORT_ID return value, and act accordingly // read_port() will see the B_BAD_PORT_ID return value, and act accordingly
port.read_condition.NotifyAll(B_BAD_PORT_ID); port.read_condition.NotifyAll(false, B_BAD_PORT_ID);
port.write_condition.NotifyAll(B_BAD_PORT_ID); port.write_condition.NotifyAll(false, B_BAD_PORT_ID);
sNotificationService.Notify(PORT_REMOVED, id); sNotificationService.Notify(PORT_REMOVED, id);
} }
@ -1077,12 +1077,14 @@ _get_port_message_info_etc(port_id id, port_message_info* info,
} }
locker.Lock(); locker.Lock();
}
if (sPorts[slot].id != id) { if (sPorts[slot].id != id
|| (is_port_closed(slot) && sPorts[slot].messages.IsEmpty())) {
// the port is no longer there // the port is no longer there
T(Info(sPorts[slot], 0, B_BAD_PORT_ID));
return B_BAD_PORT_ID; return B_BAD_PORT_ID;
} }
}
// determine tail & get the length of the message // determine tail & get the length of the message
port_message* message = sPorts[slot].messages.Head(); port_message* message = sPorts[slot].messages.Head();