Subversion Repositories HelenOS

Compare Revisions

Regard whitespace Rev 410 → Rev 411

/SPARTAN/trunk/include/synch/synch.h
29,7 → 29,7
#ifndef __SYNCH_H__
#define __SYNCH_H__
 
#define SYNCH_NO_TIMEOUT 0 /**< No timeout is request. */
#define SYNCH_NO_TIMEOUT 0 /**< Request with no timeout. */
#define SYNCH_BLOCKING 0 /**< Blocking operation request. */
#define SYNCH_NON_BLOCKING 1 /**< Non-blocking operation request. */
 
/SPARTAN/trunk/include/time/timeout.h
36,25 → 36,25
 
#define us2ticks(us) ((__u64)(((__u32) (us)/(1000000/HZ))))
 
typedef void (* timeout_handler)(void *arg);
typedef void (* timeout_handler_t)(void *arg);
 
struct timeout {
spinlock_t lock;
 
link_t link;
link_t link; /**< Link to the list of active timeouts on THE->cpu */
__u64 ticks;
__u64 ticks; /**< Timeout will be activated in this amount of clock() ticks. */
 
timeout_handler handler;
void *arg;
timeout_handler_t handler; /**< Function that will be called on timeout activation. */
void *arg; /**< Argument to be passed to handler() function. */
cpu_t *cpu;
cpu_t *cpu; /**< On which processor is this timeout registered. */
};
 
extern void timeout_init(void);
extern void timeout_initialize(timeout_t *t);
extern void timeout_reinitialize(timeout_t *t);
extern void timeout_register(timeout_t *t, __u64 usec, timeout_handler f, void *arg);
extern int timeout_unregister(timeout_t *t);
extern void timeout_register(timeout_t *t, __u64 usec, timeout_handler_t f, void *arg);
extern bool timeout_unregister(timeout_t *t);
 
#endif
/SPARTAN/trunk/src/preempt/preemption.c
32,6 → 32,7
#include <arch/barrier.h>
#include <debug.h>
 
/** Increment preemption disabled counter. */
void preemption_disable(void)
{
THE->preemption_disabled++;
38,6 → 39,7
memory_barrier();
}
 
/** Decrement preemption disabled counter. */
void preemption_enable(void)
{
ASSERT(THE->preemption_disabled);
/SPARTAN/trunk/src/time/timeout.c
52,11 → 52,11
}
 
 
/** Initialize empty timeout list
/** Reinitialize timeout
*
* Initialize the timeout list to be empty.
* Initialize all members except the lock.
*
* @param t Timeout list to be initialized.
* @param t Timeout to be initialized.
*
*/
void timeout_reinitialize(timeout_t *t)
69,11 → 69,11
}
 
 
/** Initialize timeout list
/** Initialize timeout
*
* Initialize the timeout list and its spinlock.
* Initialize all members including the lock.
*
* @param t Timeout list to be initialized.
* @param t Timeout to be initialized.
*
*/
void timeout_initialize(timeout_t *t)
83,13 → 83,13
}
 
 
/** Register timeout callback
/** Register timeout
*
* Insert the timeout handler f (with argument arg)
* to the timeout list and make it execute in
* Insert timeout handler f (with argument arg)
* to timeout list and make it execute in
* time microseconds (or slightly more).
*
* @param t Timeout list.
* @param t Timeout structure.
* @param time Number of usec in the future to execute
* the handler.
* @param f Timeout handler function.
96,7 → 96,7
* @param arg Timeout handler argument.
*
*/
void timeout_register(timeout_t *t, __u64 time, timeout_handler f, void *arg)
void timeout_register(timeout_t *t, __u64 time, timeout_handler_t f, void *arg)
{
timeout_t *hlp;
link_t *l, *m;
156,14 → 156,15
}
 
 
/** Unregister timeout callback
/** Unregister timeout
*
* Remove timeout from timeout list.
*
* @param t Timeout to unregister.
*
* @return true on success, false on failure.
*/
int timeout_unregister(timeout_t *t)
bool timeout_unregister(timeout_t *t)
{
timeout_t *hlp;
link_t *l;
175,7 → 176,7
if (!t->cpu) {
spinlock_unlock(&t->lock);
cpu_priority_restore(pri);
return 0;
return false;
}
if (!spinlock_trylock(&t->cpu->timeoutlock)) {
spinlock_unlock(&t->lock);
203,5 → 204,5
spinlock_unlock(&t->lock);
 
cpu_priority_restore(pri);
return 1;
return true;
}
/SPARTAN/trunk/src/time/clock.c
52,7 → 52,7
{
link_t *l;
timeout_t *h;
timeout_handler f;
timeout_handler_t f;
void *arg;
 
/*