1 /* 2 * Copyright (c) 2023 Ali Mashtizadeh 3 * All rights reserved. 4 */ 5 6 #include <stdbool.h> 7 #include <stdint.h> 8 #include <string.h> 9 10 #include <sys/cdefs.h> 11 #include <sys/kassert.h> 12 #include <sys/kconfig.h> 13 #include <sys/kdebug.h> 14 #include <sys/kmem.h> 15 #include <sys/mp.h> 16 #include <sys/queue.h> 17 #include <sys/thread.h> 18 #include <sys/spinlock.h> 19 #include <sys/waitchannel.h> 20 #include <sys/mutex.h> 21 #include <sys/cv.h> 22 #include <errno.h> 23 24 void CV_Init(CV * cv,const char * name)25CV_Init(CV *cv, const char *name) 26 { 27 WaitChannel_Init(&cv->chan, name); 28 29 return; 30 } 31 32 void CV_Destroy(CV * cv)33CV_Destroy(CV *cv) 34 { 35 WaitChannel_Destroy(&cv->chan); 36 37 return; 38 } 39 40 /** 41 * CV_Wait -- 42 * 43 * Wait to be woken up on a condition. 44 */ 45 void CV_Wait(CV * cv,Mutex * mtx)46CV_Wait(CV *cv, Mutex *mtx) 47 { 48 /* Do not go to sleep holding a spinlock! */ 49 ASSERT(Critical_Level() == 0); 50 /* XXXFILLMEIN */ 51 } 52 53 /** 54 * CV_Signal -- 55 * 56 * Wake a single thread waiting on the condition. 57 */ 58 void CV_Signal(CV * cv)59CV_Signal(CV *cv) 60 { 61 /* XXXFILLMEIN */ 62 } 63 64 /** 65 * CV_Broadcast -- 66 * 67 * Wake all threads waiting on the condition. 68 */ 69 void CV_Broadcast(CV * cv)70CV_Broadcast(CV *cv) 71 { 72 /* XXXFILLMEIN */ 73 } 74 75