Skip to content

Commit 1cacd76

Browse files
committed
Make sure task unwaits from tasking directory
1 parent aed8e8c commit 1cacd76

File tree

3 files changed

+17
-0
lines changed

3 files changed

+17
-0
lines changed

kernel/src/kernel/calls/syscall_tasking.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -297,6 +297,12 @@ void syscallAwaitTaskByIdentifier(g_task* task, g_syscall_task_await_by_id* data
297297
taskingDirectoryWaitForRegister(data->identifier, task->id);
298298
});
299299
clockUnwaitForTime(task->id);
300+
taskingDirectoryUnwaitForRegister(data->identifier, task->id);
301+
302+
taskingWait(task, __func__, [data, task]()
303+
{
304+
clockWaitForTime(task->id, clockGetLocal()->time + 500);
305+
});
300306
}
301307
data->task = target;
302308
}

kernel/src/kernel/tasking/tasking_directory.cpp

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,16 @@ void taskingDirectoryWaitForRegister(const char* name, g_tid task)
5858
mutexRelease(&entryLock);
5959
}
6060

61+
void taskingDirectoryUnwaitForRegister(const char* name, g_tid task)
62+
{
63+
mutexAcquire(&entryLock);
64+
65+
auto entry = _taskingDirectoryGetOrCreateEntry(name);
66+
waitQueueRemove(&entry->waitQueue, task);
67+
68+
mutexRelease(&entryLock);
69+
}
70+
6171
bool taskingDirectoryRegister(const char* name, g_tid tid, g_security_level priority)
6272
{
6373
bool success = false;

kernel/src/kernel/tasking/tasking_directory.hpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,5 +56,6 @@ const char* taskingDirectoryGetIdentifier(g_tid tid);
5656
* Adds the task to the wait queue for when another task registers with this identifier.
5757
*/
5858
void taskingDirectoryWaitForRegister(const char* name, g_tid task);
59+
void taskingDirectoryUnwaitForRegister(const char* name, g_tid task);
5960

6061
#endif

0 commit comments

Comments
 (0)