Changeset 116d1ef4 in mainline for generic/include


Ignore:
Timestamp:
2006-06-02T12:26:50Z (19 years ago)
Author:
Jakub Jermar <jakub@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
d0c5901
Parents:
01ebbdf
Message:

Replace nonblocking argument of waitq_sleep_timeout with flags that specify mode of operation.
Now a flag can be used to specify interruptible sleep.
Modify waitq_interrupt_sleep() to only interrupt threads that used this flag.
O

Location:
generic/include
Files:
9 edited

Legend:

Unmodified
Added
Removed
  • generic/include/ipc/ipc.h

    r01ebbdf r116d1ef4  
    210210
    211211extern void ipc_init(void);
    212 extern call_t * ipc_wait_for_call(answerbox_t *box, __u32 usec, int nonblocking);
     212extern call_t * ipc_wait_for_call(answerbox_t *box, __u32 usec, int flags);
    213213extern void ipc_answer(answerbox_t *box, call_t *request);
    214214extern int ipc_call(phone_t *phone, call_t *call);
  • generic/include/proc/thread.h

    r01ebbdf r116d1ef4  
    8888        context_t sleep_interruption_context;
    8989
     90        bool sleep_interruptible;               /**< If true, the thread can be interrupted from sleep. */
    9091        waitq_t *sleep_queue;                   /**< Wait queue in which this thread sleeps. */
    9192        timeout_t sleep_timeout;                /**< Timeout used for timeoutable sleeping.  */
  • generic/include/synch/condvar.h

    r01ebbdf r116d1ef4  
    4040
    4141#define condvar_wait(cv,mtx) \
    42         _condvar_wait_timeout((cv),(mtx),SYNCH_NO_TIMEOUT)
     42        _condvar_wait_timeout((cv),(mtx),SYNCH_NO_TIMEOUT,SYNCH_FLAGS_NONE)
    4343#define condvar_wait_timeout(cv,mtx,usec) \
    44         _condvar_wait_timeout((cv),(mtx),(usec))
     44        _condvar_wait_timeout((cv),(mtx),(usec),SYNCH_FLAGS_NONE)
    4545
    4646extern void condvar_initialize(condvar_t *cv);
    4747extern void condvar_signal(condvar_t *cv);
    4848extern void condvar_broadcast(condvar_t *cv);
    49 extern int _condvar_wait_timeout(condvar_t *cv, mutex_t *mtx, __u32 usec);
     49extern int _condvar_wait_timeout(condvar_t *cv, mutex_t *mtx, __u32 usec, int flags);
    5050
    5151#endif
  • generic/include/synch/futex.h

    r01ebbdf r116d1ef4  
    4545
    4646extern void futex_init(void);
    47 extern __native sys_futex_sleep_timeout(__address uaddr, __u32 usec, int trydown);
     47extern __native sys_futex_sleep_timeout(__address uaddr, __u32 usec, int flags);
    4848extern __native sys_futex_wakeup(__address uaddr);
    4949
  • generic/include/synch/mutex.h

    r01ebbdf r116d1ef4  
    4040
    4141#define mutex_lock(mtx) \
    42         _mutex_lock_timeout((mtx),SYNCH_NO_TIMEOUT,SYNCH_BLOCKING)
     42        _mutex_lock_timeout((mtx),SYNCH_NO_TIMEOUT,SYNCH_FLAGS_NONE)
    4343#define mutex_trylock(mtx) \
    44         _mutex_lock_timeout((mtx),SYNCH_NO_TIMEOUT,SYNCH_NON_BLOCKING)
     44        _mutex_lock_timeout((mtx),SYNCH_NO_TIMEOUT,SYNCH_FLAGS_NON_BLOCKING)
    4545#define mutex_lock_timeout(mtx,usec) \
    46         _mutex_lock_timeout((mtx),(usec),SYNCH_NON_BLOCKING)
     46        _mutex_lock_timeout((mtx),(usec),SYNCH_FLAGS_NON_BLOCKING)
    4747#define mutex_lock_active(mtx) \
    4848        while (mutex_trylock((mtx)) != ESYNCH_OK_ATOMIC)
    4949
    5050extern void mutex_initialize(mutex_t *mtx);
    51 extern int _mutex_lock_timeout(mutex_t *mtx, __u32 usec, int trylock);
     51extern int _mutex_lock_timeout(mutex_t *mtx, __u32 usec, int flags);
    5252extern void mutex_unlock(mutex_t *mtx);
    5353
  • generic/include/synch/rwlock.h

    r01ebbdf r116d1ef4  
    4949
    5050#define rwlock_write_lock(rwl) \
    51         _rwlock_write_lock_timeout((rwl),SYNCH_NO_TIMEOUT,SYNCH_BLOCKING)
     51        _rwlock_write_lock_timeout((rwl),SYNCH_NO_TIMEOUT,SYNCH_FLAGS_NONE)
    5252#define rwlock_read_lock(rwl) \
    53         _rwlock_read_lock_timeout((rwl),SYNCH_NO_TIMEOUT,SYNCH_BLOCKING)
     53        _rwlock_read_lock_timeout((rwl),SYNCH_NO_TIMEOUT,SYNCH_FLAGS_NONE)
    5454#define rwlock_write_trylock(rwl) \
    55         _rwlock_write_lock_timeout((rwl),SYNCH_NO_TIMEOUT,SYNCH_NON_BLOCKING)
     55        _rwlock_write_lock_timeout((rwl),SYNCH_NO_TIMEOUT,SYNCH_FLAGS_NON_BLOCKING)
    5656#define rwlock_read_trylock(rwl) \
    57         _rwlock_read_lock_timeout((rwl),SYNCH_NO_TIMEOUT,SYNCH_NON_BLOCKING)
     57        _rwlock_read_lock_timeout((rwl),SYNCH_NO_TIMEOUT,SYNCH_FLAGS_NON_BLOCKING)
    5858#define rwlock_write_lock_timeout(rwl,usec) \
    59         _rwlock_write_lock_timeout((rwl),(usec),SYNCH_NON_BLOCKING)
     59        _rwlock_write_lock_timeout((rwl),(usec),SYNCH_FLAGS_NONE)
    6060#define rwlock_read_lock_timeout(rwl,usec) \
    61         _rwlock_read_lock_timeout((rwl),(usec),SYNCH_NON_BLOCKING)
     61        _rwlock_read_lock_timeout((rwl),(usec),SYNCH_FLAGS_NONE)
    6262
    6363extern void rwlock_initialize(rwlock_t *rwl);
    6464extern void rwlock_read_unlock(rwlock_t *rwl);
    6565extern void rwlock_write_unlock(rwlock_t *rwl);
    66 extern int _rwlock_read_lock_timeout(rwlock_t *rwl, __u32 usec, int trylock);
    67 extern int _rwlock_write_lock_timeout(rwlock_t *rwl, __u32 usec, int trylock);
     66extern int _rwlock_read_lock_timeout(rwlock_t *rwl, __u32 usec, int flags);
     67extern int _rwlock_write_lock_timeout(rwlock_t *rwl, __u32 usec, int flags);
    6868
    6969#endif
     70
  • generic/include/synch/semaphore.h

    r01ebbdf r116d1ef4  
    4141
    4242#define semaphore_down(s) \
    43         _semaphore_down_timeout((s),SYNCH_NO_TIMEOUT,SYNCH_BLOCKING)
     43        _semaphore_down_timeout((s),SYNCH_NO_TIMEOUT,SYNCH_FLAGS_NONE)
    4444#define semaphore_trydown(s) \
    45         _semaphore_down_timeout((s),SYNCH_NO_TIMEOUT,SYNCH_NON_BLOCKING)       
     45        _semaphore_down_timeout((s),SYNCH_NO_TIMEOUT,SYNCH_FLAGS_NON_BLOCKING) 
    4646#define semaphore_down_timeout(s,usec) \
    47         _semaphore_down_timeout((s),(usec),SYNCH_NON_BLOCKING)
     47        _semaphore_down_timeout((s),(usec),SYNCH_FLAGS_NONE)
    4848
    4949extern void semaphore_initialize(semaphore_t *s, int val);
    50 extern int _semaphore_down_timeout(semaphore_t *s, __u32 usec, int trydown);
     50extern int _semaphore_down_timeout(semaphore_t *s, __u32 usec, int flags);
    5151extern void semaphore_up(semaphore_t *s);
    5252
    5353#endif
     54
  • generic/include/synch/synch.h

    r01ebbdf r116d1ef4  
    3131
    3232#define SYNCH_NO_TIMEOUT        0       /**< Request with no timeout. */
    33 #define SYNCH_BLOCKING          0       /**< Blocking operation request. */
    34 #define SYNCH_NON_BLOCKING      1       /**< Non-blocking operation request. */
     33
     34#define SYNCH_FLAGS_NONE                0       /**< No flags specified. */
     35#define SYNCH_FLAGS_NON_BLOCKING        (1<<0)  /**< Non-blocking operation request. */
     36#define SYNCH_FLAGS_INTERRUPTIBLE       (1<<1)  /**< Interruptible operation. */
    3537
    3638#define ESYNCH_WOULD_BLOCK      1       /**< Could not satisfy the request without going to sleep. */
  • generic/include/synch/waitq.h

    r01ebbdf r116d1ef4  
    5353
    5454#define waitq_sleep(wq) \
    55         waitq_sleep_timeout((wq),SYNCH_NO_TIMEOUT,SYNCH_BLOCKING)
     55        waitq_sleep_timeout((wq),SYNCH_NO_TIMEOUT,SYNCH_FLAGS_NONE)
    5656
    5757extern void waitq_initialize(waitq_t *wq);
    58 extern int waitq_sleep_timeout(waitq_t *wq, __u32 usec, int nonblocking);
     58extern int waitq_sleep_timeout(waitq_t *wq, __u32 usec, int flags);
    5959extern ipl_t waitq_sleep_prepare(waitq_t *wq);
    60 extern int waitq_sleep_timeout_unsafe(waitq_t *wq, __u32 usec, int nonblocking);
     60extern int waitq_sleep_timeout_unsafe(waitq_t *wq, __u32 usec, int flags);
    6161extern void waitq_sleep_finish(waitq_t *wq, int rc, ipl_t ipl);
    6262extern void waitq_wakeup(waitq_t *wq, bool all);
Note: See TracChangeset for help on using the changeset viewer.