mirror of
https://gitlab.com/sortix/sortix.git
synced 2023-02-13 20:55:38 -05:00
Fix deadlock in kthread_cond_wait.
This commit is contained in:
parent
dd0379c608
commit
2231e129b0
1 changed files with 4 additions and 2 deletions
|
@ -60,7 +60,8 @@ extern "C" void kthread_cond_wait(kthread_cond_t* cond, kthread_mutex_t* mutex)
|
||||||
elem.next = NULL;
|
elem.next = NULL;
|
||||||
elem.woken = 0;
|
elem.woken = 0;
|
||||||
if ( cond->last ) { cond->last->next = &elem; }
|
if ( cond->last ) { cond->last->next = &elem; }
|
||||||
if ( !cond->last ) { cond->last = cond->first = &elem; }
|
if ( !cond->last ) { cond->first = &elem; }
|
||||||
|
cond->last = &elem;
|
||||||
while ( !elem.woken )
|
while ( !elem.woken )
|
||||||
{
|
{
|
||||||
kthread_mutex_unlock(mutex);
|
kthread_mutex_unlock(mutex);
|
||||||
|
@ -78,7 +79,8 @@ extern "C" unsigned long kthread_cond_wait_signal(kthread_cond_t* cond,
|
||||||
elem.next = NULL;
|
elem.next = NULL;
|
||||||
elem.woken = 0;
|
elem.woken = 0;
|
||||||
if ( cond->last ) { cond->last->next = &elem; }
|
if ( cond->last ) { cond->last->next = &elem; }
|
||||||
if ( !cond->last ) { cond->last = cond->first = &elem; }
|
if ( !cond->last ) { cond->first = &elem; }
|
||||||
|
cond->last = &elem;
|
||||||
while ( !elem.woken )
|
while ( !elem.woken )
|
||||||
{
|
{
|
||||||
if ( Signal::IsPending() )
|
if ( Signal::IsPending() )
|
||||||
|
|
Loading…
Reference in a new issue