parlib: Always use the default mutex/cv interface
[akaros.git] / user / parlib / thread0_sched.c
index f85abe0..39b4a2a 100644 (file)
@@ -23,11 +23,6 @@ static void thread0_thread_refl_fault(struct uthread *uth,
 static void thread0_thread_runnable(struct uthread *uth);
 static void thread0_thread_has_blocked(struct uthread *uth, uth_sync_t sync,
                                        int flags);
-static uth_mutex_t thread0_mtx_alloc(void);
-static void thread0_mtx_free(uth_mutex_t m);
-static void thread0_mtx_lock(uth_mutex_t m);
-static bool thread0_mtx_trylock(uth_mutex_t m);
-static void thread0_mtx_unlock(uth_mutex_t m);
 static uth_sync_t thread0_sync_alloc(void);
 static void thread0_sync_free(uth_sync_t);
 static struct uthread *thread0_sync_get_next(uth_sync_t);
@@ -41,11 +36,6 @@ struct schedule_ops thread0_2ls_ops = {
        .thread_runnable = thread0_thread_runnable,
        .thread_paused = thread0_thread_runnable,
        .thread_has_blocked = thread0_thread_has_blocked,
-       .mutex_alloc = thread0_mtx_alloc,
-       .mutex_free = thread0_mtx_free,
-       .mutex_lock = thread0_mtx_lock,
-       .mutex_trylock = thread0_mtx_trylock,
-       .mutex_unlock = thread0_mtx_unlock,
        .sync_alloc = thread0_sync_alloc,
        .sync_free = thread0_sync_free,
        .sync_get_next = thread0_sync_get_next,
@@ -158,51 +148,6 @@ static void thread0_thread_has_blocked(struct uthread *uth, uth_sync_t sync,
        thread0_info.is_blocked = TRUE;
 }
 
-/* We only have one thread, so we don't *need* mutexes.  But we'll use a bool to
- * catch code that could deadlock itself. */
-static uth_mutex_t thread0_mtx_alloc(void)
-{
-       bool *mtx = malloc(sizeof(bool));
-
-       assert(mtx);
-       *mtx = FALSE;
-       return (uth_mutex_t)mtx;
-}
-
-static void thread0_mtx_free(uth_mutex_t m)
-{
-       bool *mtx = (bool*)m;
-
-       assert(*mtx == FALSE);
-       free((void*)m);
-}
-
-static void thread0_mtx_lock(uth_mutex_t m)
-{
-       bool *mtx = (bool*)m;
-
-       assert(*mtx == FALSE);
-       *mtx = TRUE;
-}
-
-static bool thread0_mtx_trylock(uth_mutex_t m)
-{
-       bool *mtx = (bool*)m;
-
-       if (*mtx)
-               return FALSE;
-       *mtx = TRUE;
-       return TRUE;
-}
-
-static void thread0_mtx_unlock(uth_mutex_t m)
-{
-       bool *mtx = (bool*)m;
-
-       assert(*mtx == TRUE);
-       *mtx = FALSE;
-}
-
 static uth_sync_t thread0_sync_alloc(void)
 {
        return (void*)0xf00baa;