Last change
on this file since 4997 was 4071, checked in by vboxsync, 17 years ago |
Biggest check-in ever. New source code headers for all (C) innotek files.
|
-
Property svn:eol-style
set to
native
-
Property svn:keywords
set to
Author Date Id Revision
|
File size:
2.0 KB
|
Line | |
---|
1 | /** @file
|
---|
2 | *
|
---|
3 | */
|
---|
4 |
|
---|
5 | /*
|
---|
6 | * Copyright (C) 2006-2007 innotek GmbH
|
---|
7 | *
|
---|
8 | * This file is part of VirtualBox Open Source Edition (OSE), as
|
---|
9 | * available from http://www.virtualbox.org. This file is free software;
|
---|
10 | * you can redistribute it and/or modify it under the terms of the GNU
|
---|
11 | * General Public License as published by the Free Software Foundation,
|
---|
12 | * in version 2 as it comes in the "COPYING" file of the VirtualBox OSE
|
---|
13 | * distribution. VirtualBox OSE is distributed in the hope that it will
|
---|
14 | * be useful, but WITHOUT ANY WARRANTY of any kind.
|
---|
15 | */
|
---|
16 |
|
---|
17 |
|
---|
18 | #ifndef wait_event_timeout
|
---|
19 | #define wait_event_timeout(wq, condition, timeout) \
|
---|
20 | ({ \
|
---|
21 | long __ret = timeout; \
|
---|
22 | if (!(condition)) \
|
---|
23 | __wait_event_timeout(wq, condition, __ret); \
|
---|
24 | __ret; \
|
---|
25 | })
|
---|
26 |
|
---|
27 | #define __wait_event_timeout(wq, condition, ret) \
|
---|
28 | do { \
|
---|
29 | wait_queue_t __wait; \
|
---|
30 | init_waitqueue_entry(&__wait, current); \
|
---|
31 | \
|
---|
32 | add_wait_queue(&wq, &__wait); \
|
---|
33 | for (;;) { \
|
---|
34 | set_current_state(TASK_UNINTERRUPTIBLE); \
|
---|
35 | if (condition) \
|
---|
36 | break; \
|
---|
37 | ret = schedule_timeout(ret); \
|
---|
38 | if (!ret) \
|
---|
39 | break; \
|
---|
40 | } \
|
---|
41 | current->state = TASK_RUNNING; \
|
---|
42 | remove_wait_queue(&wq, &__wait); \
|
---|
43 | } while (0)
|
---|
44 | #endif
|
---|
Note:
See
TracBrowser
for help on using the repository browser.