From 1e8dc0da170e687e6c9011ff29f7cf02ae124b82 Mon Sep 17 00:00:00 2001 From: Christoph Hellwig <hch@cloudius-systems.com> Date: Thu, 7 Feb 2013 14:42:38 +0100 Subject: [PATCH] remove an accidentally added file --- libc/thread/wait.cc | 45 --------------------------------------------- 1 file changed, 45 deletions(-) delete mode 100644 libc/thread/wait.cc diff --git a/libc/thread/wait.cc b/libc/thread/wait.cc deleted file mode 100644 index e391b70f8..000000000 --- a/libc/thread/wait.cc +++ /dev/null @@ -1,45 +0,0 @@ - -struct sem_waiter { - struct sem_waiter* prev; - struct sem_waiter* next; - sched::thread* thread; -}; - -extern "C" void sem_wait(mutex_t *mutex) -{ - struct waiter w; - - w.thread = sched::thread::current(); - - spin_lock(&mutex->_wait_lock); - if (!mutex->_wait_list.first) { - mutex->_wait_list.first = &w; - } else { - mutex->_wait_list.last->next = &w; - w.prev = mutex->_wait_list.last; - } - mutex->_wait_list.last = &w; - spin_unlock(&mutex->_wait_lock); - - sched::thread::wait_until([=] { - return !mutex->_locked && mutex->_wait_list.first == &w; - }); - - spin_lock(&mutex->_wait_lock); - if (mutex->_wait_list.first == &w) - mutex->_wait_list.first = w.next; - else - w.prev->next = w.next; - - if (mutex->_wait_list.last == &w) - mutex->_wait_list.last = w.prev; - spin_unlock(&mutex->_wait_lock); -} - -extern "C" void sem_wake(sem_t *sem) -{ - spin_lock(&mutex->_wait_lock); - if (mutex->_wait_list.first) - mutex->_wait_list.first->thread->wake(); - spin_unlock(&mutex->_wait_lock); -} -- GitLab