kernel/events: Fix wait_for_objects.
In the preceding commit, I missed that "events" was cleared inside the select loop, making a use later on useless. Now we don't clear it in the loop, but wait till the end to do so. (Considering we return without clearing it in case of out-of-memory or other problems, this may not even be necessary, but it at least preserves existing behavior.)
This commit is contained in:
@@ -682,7 +682,6 @@ common_wait_for_objects(object_wait_info* infos, int numInfos, uint32 flags,
|
||||
infos[i].events |= B_EVENT_INVALID | B_EVENT_ERROR | B_EVENT_DISCONNECTED;
|
||||
sync->set[i].selected_events = infos[i].events;
|
||||
sync->set[i].events = 0;
|
||||
infos[i].events = 0;
|
||||
|
||||
if (select_object(type, object, sync->set + i, kernel) != B_OK) {
|
||||
// If the object returned events as well as an error, ignore the error.
|
||||
@@ -705,7 +704,6 @@ common_wait_for_objects(object_wait_info* infos, int numInfos, uint32 flags,
|
||||
|
||||
for (int i = 0; i < numInfos; i++) {
|
||||
uint16 type = infos[i].type;
|
||||
|
||||
if ((infos[i].events & B_EVENT_INVALID) == 0)
|
||||
deselect_object(type, infos[i].object, sync->set + i, kernel);
|
||||
}
|
||||
@@ -722,6 +720,8 @@ common_wait_for_objects(object_wait_info* infos, int numInfos, uint32 flags,
|
||||
} else {
|
||||
// B_INTERRUPTED, B_TIMED_OUT, and B_WOULD_BLOCK
|
||||
count = status;
|
||||
for (int i = 0; i < numInfos; i++)
|
||||
infos[i].events = 0;
|
||||
}
|
||||
|
||||
put_select_sync(sync);
|
||||
|
||||
Reference in New Issue
Block a user