Subversion Repositories Kolibri OS

Rev

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

Rev 3297 Rev 3391
Line 3... Line 3...
3
 
3
 
4
#include 
4
#include 
Line 5... Line 5...
5
#include 
5
#include 
-
 
6
 
-
 
7
typedef struct __wait_queue wait_queue_t;
6
 
8
typedef int (*wait_queue_func_t)(wait_queue_t *wait, unsigned mode, int flags, void *key);
Line 7... Line 9...
7
typedef struct __wait_queue wait_queue_t;
9
 
8
typedef struct __wait_queue_head wait_queue_head_t;
10
typedef struct __wait_queue_head wait_queue_head_t;
-
 
11
 
9
 
12
struct __wait_queue
10
struct __wait_queue
13
{
11
{
14
    wait_queue_func_t func;
Line 12... Line 15...
12
    struct list_head task_list;
15
    struct list_head task_list;
Line 56... Line 59...
56
    spin_unlock_irqrestore(&wq.lock, flags);                \
59
    spin_unlock_irqrestore(&wq.lock, flags);                \
57
                                                            \
60
                                                            \
58
    for(;;){                                                \
61
    for(;;){                                                \
59
        if (condition)                                      \
62
        if (condition)                                      \
60
            break;                                          \
63
            break;                                          \
61
        WaitEvent(__wait.evnt);                             \
64
        WaitEventTimeout(__wait.evnt, timeout);             \
62
    };                                                      \
65
    };                                                      \
63
    if (!list_empty(&__wait.task_list)) {                   \
66
    if (!list_empty(&__wait.task_list)) {                   \
64
        spin_lock_irqsave(&wq.lock, flags);                 \
67
        spin_lock_irqsave(&wq.lock, flags);                 \
65
        list_del_init(&__wait.task_list);                   \
68
        list_del_init(&__wait.task_list);                   \
66
        spin_unlock_irqrestore(&wq.lock, flags);            \
69
        spin_unlock_irqrestore(&wq.lock, flags);            \
Line 189... Line 192...
189
struct completion {
192
struct completion {
190
    unsigned int done;
193
    unsigned int done;
191
    wait_queue_head_t wait;
194
    wait_queue_head_t wait;
192
};
195
};
Line -... Line 196...
-
 
196
 
-
 
197
int autoremove_wake_function(wait_queue_t *wait, unsigned mode, int sync, void *key);
-
 
198
 
-
 
199
 
-
 
200
#define DEFINE_WAIT_FUNC(name, function)                                \
-
 
201
        wait_queue_t name = {                                           \
-
 
202
                .func           = function,                             \
-
 
203
                .task_list      = LIST_HEAD_INIT((name).task_list),     \
-
 
204
                .evnt           = CreateEvent(NULL, MANUAL_DESTROY),    \
-
 
205
        }
-
 
206
 
-
 
207
#define DEFINE_WAIT(name) DEFINE_WAIT_FUNC(name, autoremove_wake_function)
Line 193... Line 208...
193
 
208