VirtualBox

source: vbox/trunk/src/VBox/Additions/linux/module/waitcompat.h@ 2195

Last change on this file since 2195 was 2195, checked in by vboxsync, 18 years ago

cosmetical fixes

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 2.2 KB
Line 
1/** @file
2 *
3 */
4
5/*
6 * Copyright (C) 2006 InnoTek Systemberatung 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 * If you received this file as part of a commercial VirtualBox
17 * distribution, then only the terms of your commercial VirtualBox
18 * license agreement apply instead of the previous paragraph.
19 */
20
21
22#ifndef wait_event_timeout
23#define wait_event_timeout(wq, condition, timeout) \
24({ \
25 long __ret = timeout; \
26 if (!(condition)) \
27 __wait_event_timeout(wq, condition, __ret); \
28 __ret; \
29 })
30
31#define __wait_event_timeout(wq, condition, ret) \
32do { \
33 wait_queue_t __wait; \
34 init_waitqueue_entry(&__wait, current); \
35 \
36 add_wait_queue(&wq, &__wait); \
37 for (;;) { \
38 set_current_state(TASK_UNINTERRUPTIBLE); \
39 if (condition) \
40 break; \
41 ret = schedule_timeout(ret); \
42 if (!ret) \
43 break; \
44 } \
45 current->state = TASK_RUNNING; \
46 remove_wait_queue(&wq, &__wait); \
47} while (0)
48#endif
Note: See TracBrowser for help on using the repository browser.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette