Subversion Repositories Kolibri OS

Rev

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

Rev 2967 Rev 3031
Line 34... Line 34...
34
        }                                                               \
34
        }                                                               \
35
        finish_wait(&wq, &__wait);                                      \
35
        finish_wait(&wq, &__wait);                                      \
36
} while (0)
36
} while (0)
Line -... Line 37...
-
 
37
 
-
 
38
 
-
 
39
 
-
 
40
 
-
 
41
#define wait_event_timeout(wq, condition, timeout)          \
-
 
42
({                                                          \
-
 
43
    long __ret = timeout;                                   \
-
 
44
do{                                                         \
-
 
45
    wait_queue_t __wait = {                                 \
-
 
46
        .task_list = LIST_HEAD_INIT(__wait.task_list),      \
-
 
47
        .evnt      = CreateEvent(NULL, MANUAL_DESTROY),     \
-
 
48
    };                                                      \
-
 
49
    u32  flags;                                             \
-
 
50
                                                            \
-
 
51
    spin_lock_irqsave(&wq.lock, flags);                     \
-
 
52
    if (list_empty(&__wait.task_list))                      \
-
 
53
        __add_wait_queue(&wq, &__wait);                     \
-
 
54
    spin_unlock_irqrestore(&wq.lock, flags);                \
-
 
55
                                                            \
-
 
56
    for(;;){                                                \
-
 
57
        if (condition)                                      \
-
 
58
            break;                                          \
-
 
59
        WaitEvent(__wait.evnt);                             \
-
 
60
    };                                                      \
-
 
61
    if (!list_empty_careful(&__wait.task_list)) {           \
-
 
62
        spin_lock_irqsave(&wq.lock, flags);                 \
-
 
63
        list_del_init(&__wait.task_list);                   \
-
 
64
        spin_unlock_irqrestore(&wq.lock, flags);            \
-
 
65
    };                                                      \
-
 
66
    DestroyEvent(__wait.evnt);                              \
-
 
67
} while (0);                                                \
-
 
68
    __ret;                                                  \
-
 
69
})
-
 
70
 
37
 
71
 
38
 
72
 
39
#define wait_event(wq, condition)                           \
73
#define wait_event(wq, condition)                           \
40
do{                                                         \
74
do{                                                         \
41
    wait_queue_t __wait = {                                 \
75
    wait_queue_t __wait = {                                 \
Line 61... Line 95...
61
    };                                                      \
95
    };                                                      \
62
    DestroyEvent(__wait.evnt);                              \
96
    DestroyEvent(__wait.evnt);                              \
63
} while (0)
97
} while (0)
Line -... Line 98...
-
 
98
 
-
 
99
 
64
 
100
 
65
 
101
 
66
static inline
102
static inline
67
void wake_up_all(wait_queue_head_t *q)
103
void wake_up_all(wait_queue_head_t *q)
68
{
104
{
Line 125... Line 161...
125
 
161
 
126
struct delayed_work {
162
struct delayed_work {
127
    struct work_struct work;
163
    struct work_struct work;
Line 128... Line -...
128
};
-
 
129
 
164
};
130
 
165
 
Line -... Line 166...
-
 
166
struct workqueue_struct *alloc_workqueue_key(const char *fmt,
-
 
167
                           unsigned int flags, int max_active);
-
 
168
 
-
 
169
 
131
struct workqueue_struct *alloc_workqueue_key(const char *fmt,
170
#define alloc_ordered_workqueue(fmt, flags, args...)            \
132
                           unsigned int flags, int max_active);
171
        alloc_workqueue(fmt, WQ_UNBOUND | (flags), 1, ##args)
Line 133... Line 172...
133
 
172
 
134
int queue_delayed_work(struct workqueue_struct *wq,
173
int queue_delayed_work(struct workqueue_struct *wq,
135
                        struct delayed_work *dwork, unsigned long delay);
174
                        struct delayed_work *dwork, unsigned long delay);
136
 
175
 
137
#define INIT_DELAYED_WORK(_work, _func)         \
176
#define INIT_DELAYED_WORK(_work, _func)         \
Line -... Line 177...
-
 
177
    do {                                        \
-
 
178
        INIT_LIST_HEAD(&(_work)->work.entry);   \
-
 
179
        (_work)->work.func = _func;             \
-
 
180
    } while (0)
-
 
181
 
-
 
182
 
-
 
183
struct completion {
138
    do {                                        \
184
    unsigned int done;