Fork us on GitHub Follow us on Facebook Follow us on Twitter

Changeset 899f1a9 in mainline for uspace/lib/c/include/fibril_synch.h


Ignore:
Timestamp:
2011-12-11T20:27:56Z (10 years ago)
Author:
Jan Vesely <jano.vesely@…>
Branches:
lfn, master
Children:
c24c157d
Parents:
4c67e52 (diff), 9c3bba0 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
Message:

Merge mainline changes.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/lib/c/include/fibril_synch.h

    r4c67e52 r899f1a9  
    107107        fibril_condvar_t name = FIBRIL_CONDVAR_INITIALIZER(name)
    108108
     109typedef void (*fibril_timer_fun_t)(void *);
     110
     111typedef enum {
     112        /** Timer has not been set or has been cleared */
     113        fts_not_set,
     114        /** Timer was set but did not fire yet */
     115        fts_active,
     116        /** Timer has fired and has not been cleared since */
     117        fts_fired,
     118        /** Timer is being destroyed */
     119        fts_cleanup
     120} fibril_timer_state_t;
     121
     122/** Fibril timer.
     123 *
     124 * When a timer is set it executes a callback function (in a separate
     125 * fibril) after a specified time interval. The timer can be cleared
     126 * (canceled) before that. From the return value of fibril_timer_clear()
     127 * one can tell whether the timer fired or not.
     128 */
     129typedef struct {
     130        fibril_mutex_t lock;
     131        fibril_condvar_t cv;
     132        fid_t fibril;
     133        fibril_timer_state_t state;
     134
     135        suseconds_t delay;
     136        fibril_timer_fun_t fun;
     137        void *arg;
     138} fibril_timer_t;
     139
    109140extern void fibril_mutex_initialize(fibril_mutex_t *);
    110141extern void fibril_mutex_lock(fibril_mutex_t *);
     
    129160extern void fibril_condvar_broadcast(fibril_condvar_t *);
    130161
     162extern fibril_timer_t *fibril_timer_create(void);
     163extern void fibril_timer_destroy(fibril_timer_t *);
     164extern void fibril_timer_set(fibril_timer_t *, suseconds_t, fibril_timer_fun_t,
     165    void *);
     166extern fibril_timer_state_t fibril_timer_clear(fibril_timer_t *);
     167
    131168#endif
    132169
Note: See TracChangeset for help on using the changeset viewer.