Subversion Repositories Kolibri OS

Rev

Rev 3482 | Rev 4125 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 3482 Rev 3763
Line 1... Line 1...
1
#include 
1
#include 
2
#include 
2
#include 
3
#include 
3
#include 
Line -... Line 4...
-
 
4
 
-
 
5
extern int driver_wq_state;
4
 
6
 
5
struct workqueue_struct *alloc_workqueue(const char *fmt,
7
struct workqueue_struct *alloc_workqueue(const char *fmt,
6
                           unsigned int flags,
8
                           unsigned int flags,
7
                           int max_active)
9
                           int max_active)
8
{
10
{
Line 27... Line 29...
27
    unsigned long irqflags;
29
    unsigned long irqflags;
Line 28... Line 30...
28
 
30
 
29
//    dbgprintf("wq: %x head %x, next %x\n",
31
//    dbgprintf("wq: %x head %x, next %x\n",
Line 30... Line 32...
30
//               cwq, &cwq->worklist, cwq->worklist.next);
32
//               cwq, &cwq->worklist, cwq->worklist.next);
31
 
33
 
32
repeat:
34
    while(driver_wq_state != 0)
Line 33... Line 35...
33
 
35
    {
34
    spin_lock_irqsave(&cwq->lock, irqflags);
36
        spin_lock_irqsave(&cwq->lock, irqflags);
35
 
37
 
36
    while (!list_empty(&cwq->worklist))
38
        while (!list_empty(&cwq->worklist))
37
    {
39
        {
38
        struct work_struct *work = list_entry(cwq->worklist.next,
40
            struct work_struct *work = list_entry(cwq->worklist.next,
39
                                        struct work_struct, entry);
41
                                        struct work_struct, entry);
40
        work_func_t f = work->func;
42
            work_func_t f = work->func;
Line 41... Line 43...
41
        list_del_init(cwq->worklist.next);
43
            list_del_init(cwq->worklist.next);
42
//        dbgprintf("head %x, next %x\n",
44
//            printf("work %p, func %p\n",
43
//                  &cwq->worklist, cwq->worklist.next);
45
//                      work, f);
44
 
46
 
Line 45... Line 47...
45
        spin_unlock_irqrestore(&cwq->lock, irqflags);
47
            spin_unlock_irqrestore(&cwq->lock, irqflags);
Line 46... Line 48...
46
        f(work);
48
            f(work);
47
        spin_lock_irqsave(&cwq->lock, irqflags);
-
 
48
    }
49
            spin_lock_irqsave(&cwq->lock, irqflags);
49
 
50
        }
Line 50... Line 51...
50
    spin_unlock_irqrestore(&cwq->lock, irqflags);
51
 
51
 
52
        spin_unlock_irqrestore(&cwq->lock, irqflags);