VirtualBox

Changeset 24956 in vbox for trunk/src/VBox/Runtime/r0drv


Ignore:
Timestamp:
Nov 25, 2009 2:26:50 PM (15 years ago)
Author:
vboxsync
Message:

Runtime/r0drv/linux: final fix for the prepare_to_wait() / finish_wait() problem on Linux 2.4 kernels

Location:
trunk/src/VBox/Runtime/r0drv/linux
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Runtime/r0drv/linux/semevent-r0drv-linux.c

    r21538 r24956  
    169169        lTimeout = schedule_timeout(lTimeout);
    170170
     171        after_wait(&Wait);
     172
    171173        /* Check if someone destroyed the semaphore while we were waiting. */
    172174        if (pEventInt->u32Magic != RTSEMEVENT_MAGIC)
  • trunk/src/VBox/Runtime/r0drv/linux/semeventmulti-r0drv-linux.c

    r21337 r24956  
    181181        lTimeout = schedule_timeout(lTimeout);
    182182
     183        after_wait(&Wait);
     184
    183185        /* Check if someone destroyed the semaphore while we were waiting. */
    184186        if (pThis->u32Magic != RTSEMEVENTMULTI_MAGIC)
  • trunk/src/VBox/Runtime/r0drv/linux/semmutex-r0drv-linux.c

    r21337 r24956  
    170170            lTimeout = schedule_timeout(lTimeout);
    171171
     172            after_wait(&Wait);
     173
    172174            /* Check if someone destroyed the semaphore while we was waiting. */
    173175            if (pMutexInt->u32Magic != RTSEMMUTEX_MAGIC)
  • trunk/src/VBox/Runtime/r0drv/linux/the-linux-kernel.h

    r24902 r24956  
    125125
    126126/*
    127  * 2.4 compatibility wrappers
     127 * 2.4 / early 2.6 compatibility wrappers
    128128 */
    129129#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 7)
     
    163163# endif  /* < 2.4.29 || >= 2.6.0 */
    164164
     165#endif /* < 2.6.7 */
     166
     167/*
     168 * 2.4 compatibility wrappers
     169 */
     170#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 0)
     171
    165172# define prepare_to_wait(q, wait, state) \
    166173    do { \
     174        add_wait_queue(q, wait); \
    167175        set_current_state(state); \
    168         add_wait_queue(q, wait); \
     176    } while (0)
     177
     178# define after_wait(wait) \
     179    do { \
     180        list_del_init(&(wait)->task_list); \
    169181    } while (0)
    170182
    171183# define finish_wait(q, wait) \
    172184    do { \
    173         unsigned long flags; \
    174185        set_current_state(TASK_RUNNING); \
    175         spin_lock_irqsave(&(q)->lock, flags); \
    176         list_del_init(&(wait)->task_list); \
    177         spin_unlock_irqrestore(&(q)->lock, flags); \
    178     } while (0)
    179 
    180 #endif /* < 2.6.7 */
     186        remove_wait_queue(q, wait); \
     187    } while (0)
     188
     189#else /* >= 2.6.0 */
     190
     191# define after_wait(wait)       do {} while (0)
     192
     193#endif /* >= 2.6.0 */
    181194
    182195/** @def TICK_NSEC
Note: See TracChangeset for help on using the changeset viewer.

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