Changeset ba1b2194 in mainline
- Timestamp:
- 2005-10-16T19:49:15Z (19 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 75eacab
- Parents:
- 9cefba4
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
include/synch/synch.h
r9cefba4 rba1b2194 30 30 #define __SYNCH_H__ 31 31 32 #define SYNCH_NO_TIMEOUT 0 /**< No timeout is request. */32 #define SYNCH_NO_TIMEOUT 0 /**< Request with no timeout. */ 33 33 #define SYNCH_BLOCKING 0 /**< Blocking operation request. */ 34 34 #define SYNCH_NON_BLOCKING 1 /**< Non-blocking operation request. */ -
include/time/timeout.h
r9cefba4 rba1b2194 37 37 #define us2ticks(us) ((__u64)(((__u32) (us)/(1000000/HZ)))) 38 38 39 typedef void (* timeout_handler )(void *arg);39 typedef void (* timeout_handler_t)(void *arg); 40 40 41 41 struct timeout { 42 42 spinlock_t lock; 43 43 44 link_t link; 44 link_t link; /**< Link to the list of active timeouts on THE->cpu */ 45 45 46 __u64 ticks; 46 __u64 ticks; /**< Timeout will be activated in this amount of clock() ticks. */ 47 47 48 timeout_handler handler;49 void *arg; 48 timeout_handler_t handler; /**< Function that will be called on timeout activation. */ 49 void *arg; /**< Argument to be passed to handler() function. */ 50 50 51 cpu_t *cpu; 51 cpu_t *cpu; /**< On which processor is this timeout registered. */ 52 52 }; 53 53 … … 55 55 extern void timeout_initialize(timeout_t *t); 56 56 extern void timeout_reinitialize(timeout_t *t); 57 extern void timeout_register(timeout_t *t, __u64 usec, timeout_handler f, void *arg);58 extern inttimeout_unregister(timeout_t *t);57 extern void timeout_register(timeout_t *t, __u64 usec, timeout_handler_t f, void *arg); 58 extern bool timeout_unregister(timeout_t *t); 59 59 60 60 #endif -
src/preempt/preemption.c
r9cefba4 rba1b2194 33 33 #include <debug.h> 34 34 35 /** Increment preemption disabled counter. */ 35 36 void preemption_disable(void) 36 37 { … … 39 40 } 40 41 42 /** Decrement preemption disabled counter. */ 41 43 void preemption_enable(void) 42 44 { -
src/time/clock.c
r9cefba4 rba1b2194 53 53 link_t *l; 54 54 timeout_t *h; 55 timeout_handler f;55 timeout_handler_t f; 56 56 void *arg; 57 57 -
src/time/timeout.c
r9cefba4 rba1b2194 53 53 54 54 55 /** Initialize empty timeout list56 * 57 * Initialize the timeout list to be empty.58 * 59 * @param t Timeout listto be initialized.55 /** Reinitialize timeout 56 * 57 * Initialize all members except the lock. 58 * 59 * @param t Timeout to be initialized. 60 60 * 61 61 */ … … 70 70 71 71 72 /** Initialize timeout list73 * 74 * Initialize the timeout list and its spinlock.75 * 76 * @param t Timeout listto be initialized.72 /** Initialize timeout 73 * 74 * Initialize all members including the lock. 75 * 76 * @param t Timeout to be initialized. 77 77 * 78 78 */ … … 84 84 85 85 86 /** Register timeout callback87 * 88 * Insert t he timeout handler f (with argument arg)89 * to t he timeout list and make it execute in86 /** Register timeout 87 * 88 * Insert timeout handler f (with argument arg) 89 * to timeout list and make it execute in 90 90 * time microseconds (or slightly more). 91 91 * 92 * @param t Timeout list.92 * @param t Timeout structure. 93 93 * @param time Number of usec in the future to execute 94 94 * the handler. … … 97 97 * 98 98 */ 99 void timeout_register(timeout_t *t, __u64 time, timeout_handler f, void *arg)99 void timeout_register(timeout_t *t, __u64 time, timeout_handler_t f, void *arg) 100 100 { 101 101 timeout_t *hlp; … … 157 157 158 158 159 /** Unregister timeout callback159 /** Unregister timeout 160 160 * 161 161 * Remove timeout from timeout list. … … 163 163 * @param t Timeout to unregister. 164 164 * 165 */ 166 int timeout_unregister(timeout_t *t) 165 * @return true on success, false on failure. 166 */ 167 bool timeout_unregister(timeout_t *t) 167 168 { 168 169 timeout_t *hlp; … … 176 177 spinlock_unlock(&t->lock); 177 178 cpu_priority_restore(pri); 178 return 0;179 return false; 179 180 } 180 181 if (!spinlock_trylock(&t->cpu->timeoutlock)) { … … 204 205 205 206 cpu_priority_restore(pri); 206 return 1;207 } 207 return true; 208 }
Note:
See TracChangeset
for help on using the changeset viewer.