root / Whitix / branches / network / kernel / wait.c

Revision 269, 1.0 kB (checked in by mwhitworth, 9 months ago)

Move magic number code in waitqueue to ifdef code.

Line 
1#include <sched.h>
2#include <task.h>
3#include <wait.h>
4
5/***********************************************************************
6 *
7 * FUNCTION: WakeUp
8 *
9 * DESCRIPTION: Wake up all threads waiting on a waitqueue.
10 *
11 * PARAMETERS: waitQueue - wait queue in question.
12 *
13 * RETURNS: Nothing.
14 *
15 ***********************************************************************/
16
17void WakeUp(WaitQueue* waitQueue)
18{
19        struct WaitQueueEntry* curr;
20
21        /* No point if it's empty */
22        if (ListEmpty(&waitQueue->list))
23                return;
24
25        SpinLockIrq(&waitQueue->spinLock);
26
27        ListForEachEntry(curr,&(waitQueue->list),next)
28        {
29#ifdef WAIT_DEBUG
30                if (curr->magic != 0xDEADBEEF)         
31                        printf("WakeUp: Error, %#X!, thread = %#X, prev = %#X, next = %#X, magic = %#X, from %#X\n",
32                                waitQueue,curr->thread,curr->next.prev,curr->next.next,curr->magic,__builtin_return_address(0));
33#endif
34                ThrResumeThread(curr->thread); /* No need to remove entry, whole waitQueue list is destroyed */
35        }
36
37        SpinUnlockIrq(&waitQueue->spinLock);
38
39        if (thrNeedSchedule)
40                ThrSchedule();
41}
Note: See TracBrowser for help on using the browser.