Commit 9958ad4a authored by Charlie Jacobsen's avatar Charlie Jacobsen
Browse files

Add macro for function attributes.

We will use this to mark symbols as weak, so they can be redefined
easily.
parent 7bd16ea6
......@@ -39,7 +39,9 @@
/*
* Initilaizes awe mapper.
*/
void awe_mapper_init(void)
void
LIBASYNC_FUNC_ATTR
awe_mapper_init(void)
{
void* awe_map_ptr = kzalloc(sizeof(awe_table_t), GFP_KERNEL);
if( !awe_map_ptr )
......@@ -56,7 +58,9 @@ void awe_mapper_init(void)
/*
* Uninitilaizes awe mapper.
*/
void awe_mapper_uninit(void)
void
LIBASYNC_FUNC_ATTR
awe_mapper_uninit(void)
{
awe_table_t *awe_map = get_awe_map();
kfree(awe_map);
......@@ -75,7 +79,9 @@ static bool is_slot_allocated(uint32_t id)
/*
* Returns new available id.
*/
uint32_t awe_mapper_create_id(void)
uint32_t
LIBASYNC_FUNC_ATTR
awe_mapper_create_id(void)
{
awe_table_t *awe_map = get_awe_map();
BUG_ON((awe_map->used_slots >= AWE_TABLE_COUNT) && "Too many slots have been requested.");
......@@ -98,7 +104,9 @@ EXPORT_SYMBOL(awe_mapper_create_id);
/*
* Marks provided id as available
*/
void awe_mapper_remove_id(uint32_t id)
void
LIBASYNC_FUNC_ATTR
awe_mapper_remove_id(uint32_t id)
{
awe_table_t *awe_map = get_awe_map();
BUG_ON(id >= AWE_TABLE_COUNT);
......@@ -116,7 +124,9 @@ EXPORT_SYMBOL(awe_mapper_remove_id);
/*
* Links awe_ptr with id.
*/
void awe_mapper_set_id(uint32_t id, void* awe_ptr)
void
LIBASYNC_FUNC_ATTR
awe_mapper_set_id(uint32_t id, void* awe_ptr)
{
awe_table_t *awe_map = get_awe_map();
BUG_ON(id >= AWE_TABLE_COUNT);
......@@ -128,7 +138,9 @@ void awe_mapper_set_id(uint32_t id, void* awe_ptr)
/*
* Returns awe_ptr that corresponds to id.
*/
void* awe_mapper_get_awe_ptr(uint32_t id)
void*
LIBASYNC_FUNC_ATTR
awe_mapper_get_awe_ptr(uint32_t id)
{
awe_table_t *awe_map = get_awe_map();
BUG_ON(id >= AWE_TABLE_COUNT);
......@@ -137,7 +149,9 @@ void* awe_mapper_get_awe_ptr(uint32_t id)
}
void awe_mapper_print_list(void)
void
LIBASYNC_FUNC_ATTR
awe_mapper_print_list(void)
{
int i,j;
awe_table_t *awe_map = get_awe_map();
......
......@@ -133,7 +133,9 @@ static inline void thc_schedule_local(awe_t *awe);
// Per-thread state
PTState_t *PTS(void) {
PTState_t *
LIBASYNC_FUNC_ATTR
PTS(void) {
PTState_t *pts = thc_get_pts_0();
#ifndef NDEBUG
if (pts!=NULL) {
......@@ -260,7 +262,9 @@ static void thc_print_pts_stats(PTState_t *t, int clear)
// There is currently no support for extending a stack, or allowing it
// to be discontiguous
void *_thc_allocstack(void) {
void *
LIBASYNC_FUNC_ATTR
_thc_allocstack(void) {
PTState_t *pts = PTS();
void *result = NULL;
DEBUG_STACK(DEBUGPRINTF(DEBUG_STACK_PREFIX "> AllocStack\n"));
......@@ -285,7 +289,9 @@ void *_thc_allocstack(void) {
// De-allocate a stack back to THC's pool of free stacks
void _thc_freestack(void *s) {
void
LIBASYNC_FUNC_ATTR
_thc_freestack(void *s) {
PTState_t *pts = PTS();
struct thcstack_t *stack = (struct thcstack_t*)(s - sizeof(struct thcstack_t));
DEBUG_STACK(DEBUGPRINTF(DEBUG_STACK_PREFIX "> FreeStack(%p)\n", stack));
......@@ -307,7 +313,9 @@ static void thc_pendingfree(PTState_t * pts) {
}
}
void _thc_pendingfree(void) {
void
LIBASYNC_FUNC_ATTR
_thc_pendingfree(void) {
thc_pendingfree(PTS());
}
EXPORT_SYMBOL(_thc_pendingfree);
......@@ -361,7 +369,9 @@ static inline void check_lazy_stack_finished (PTState_t *pts, awe_t *awe) {
// Execute "fn(args)" on the stack growing down from "stacktop". This is
// just a wrapper around the arch-os specific function.
void _thc_onaltstack(void *stacktop, void *fn, void *args) {
void
LIBASYNC_FUNC_ATTR
_thc_onaltstack(void *stacktop, void *fn, void *args) {
DEBUG_STACK(DEBUGPRINTF(DEBUG_STACK_PREFIX "> OnAltStack(%p, %p, %p)\n",
stacktop, fn, args));
......@@ -600,7 +610,9 @@ void _thc_schedulecont_c(awe_t *awe) {
// C "used" attribute is not currently maintained through Clang & LLVM
// with the C backend, so we cannot rely on that.
extern void _thc_callcont_c(awe_t *awe, THCContFn_t fn, void *args);
void _thc_callcont_c(awe_t *awe,
void
LIBASYNC_FUNC_ATTR
_thc_callcont_c(awe_t *awe,
THCContFn_t fn,
void *args) {
PTState_t *pts = PTS();
......@@ -673,7 +685,9 @@ static inline void check_for_lazy_awe (void * ebp) { }
// fb->finish_awe which will be resumed when the final async
// call finsihes. _thc_endasync picks this up.
void _thc_startfinishblock(finish_t *fb, int fb_kind) {
void
LIBASYNC_FUNC_ATTR
_thc_startfinishblock(finish_t *fb, int fb_kind) {
PTState_t *pts = PTS();
finish_t *current_fb;
......@@ -778,7 +792,9 @@ static void thc_run_cancel_actions(PTState_t *pts, finish_t *fb) {
}
}
void _thc_do_cancel_request(finish_t *fb) {
void
LIBASYNC_FUNC_ATTR
_thc_do_cancel_request(finish_t *fb) {
PTState_t *pts = PTS();
finish_list_t *fl;
// Set own cancellation request flag
......@@ -817,7 +833,9 @@ void _thc_do_cancel_request(finish_t *fb) {
}
EXPORT_SYMBOL(_thc_do_cancel_request);
void _thc_endfinishblock(finish_t *fb, void *stack) {
void
LIBASYNC_FUNC_ATTR
_thc_endfinishblock(finish_t *fb, void *stack) {
PTState_t *pts = PTS();
DEBUG_FINISH(DEBUGPRINTF(DEBUG_FINISH_PREFIX "> EndFinishBlock(%p)\n",
fb));
......@@ -865,7 +883,9 @@ void _thc_endfinishblock(finish_t *fb, void *stack) {
EXPORT_SYMBOL(_thc_endfinishblock);
void _thc_startasync(void *f, void *stack) {
void
LIBASYNC_FUNC_ATTR
_thc_startasync(void *f, void *stack) {
finish_t *fb = (finish_t*)f;
DEBUG_FINISH(DEBUGPRINTF(DEBUG_FINISH_PREFIX "> StartAsync(%p,%p)\n",
fb, stack));
......@@ -878,7 +898,9 @@ void _thc_startasync(void *f, void *stack) {
}
EXPORT_SYMBOL(_thc_startasync);
void _thc_endasync(void *f, void *s) {
void
LIBASYNC_FUNC_ATTR
_thc_endasync(void *f, void *s) {
finish_t *fb = (finish_t*)f;
PTState_t *pts = PTS();
#ifndef NDEBUG
......@@ -921,12 +943,16 @@ EXPORT_SYMBOL(_thc_endasync);
// Operations for use by application code
void THCDumpStats(int clear_stats) {
void
LIBASYNC_FUNC_ATTR
THCDumpStats(int clear_stats) {
thc_print_pts_stats(PTS(), clear_stats);
}
EXPORT_SYMBOL(THCDumpStats);
void THCIncSendCount(void) {
void
LIBASYNC_FUNC_ATTR
THCIncSendCount(void) {
#ifndef NDEBUG
if (PTS() != NULL) {
PTS()->sendCount++;
......@@ -935,7 +961,9 @@ void THCIncSendCount(void) {
}
EXPORT_SYMBOL(THCIncSendCount);
void THCIncRecvCount(void) {
void
LIBASYNC_FUNC_ATTR
THCIncRecvCount(void) {
#ifndef NDEBUG
if (PTS() != NULL) {
PTS()->recvCount++;
......@@ -955,13 +983,17 @@ static void thc_yield_with_cont(void *a, void *arg) {
}
// Yields and saves awe_ptr to correspond to the provided id number
void THCYieldAndSave(uint32_t id_num)
void
LIBASYNC_FUNC_ATTR
THCYieldAndSave(uint32_t id_num)
{
CALL_CONT_LAZY_AND_SAVE((void*)&thc_yield_with_cont, id_num, NULL);
}
EXPORT_SYMBOL(THCYieldAndSave);
void THCYield(void) {
void
LIBASYNC_FUNC_ATTR
THCYield(void) {
CALL_CONT_LAZY((void*)&thc_yield_with_cont, NULL);
}
EXPORT_SYMBOL(THCYield);
......@@ -1031,7 +1063,9 @@ static void thc_yieldto_with_cont(void *a, void *arg) {
thc_awe_execute_0(awe);
}
void THCYieldToIdAndSave(uint32_t id_to, uint32_t id_from) {
void
LIBASYNC_FUNC_ATTR
THCYieldToIdAndSave(uint32_t id_to, uint32_t id_from) {
awe_t *awe_ptr = (awe_t *)awe_mapper_get_awe_ptr(id_to);
if (PTS() == awe_ptr->pts) {
CALL_CONT_LAZY_AND_SAVE((void*)&thc_yieldto_with_cont, id_from, (void*)awe_ptr);
......@@ -1046,7 +1080,9 @@ void THCYieldToIdAndSave(uint32_t id_to, uint32_t id_from) {
}
EXPORT_SYMBOL(THCYieldToIdAndSave);
void THCYieldToId(uint32_t id_to)
void
LIBASYNC_FUNC_ATTR
THCYieldToId(uint32_t id_to)
{
awe_t *awe_ptr = (awe_t *)awe_mapper_get_awe_ptr(id_to);
if (PTS() == awe_ptr->pts) {
......@@ -1059,7 +1095,9 @@ void THCYieldToId(uint32_t id_to)
EXPORT_SYMBOL(THCYieldToId);
void THCYieldTo(awe_t *awe_ptr) {
void
LIBASYNC_FUNC_ATTR
THCYieldTo(awe_t *awe_ptr) {
if (PTS() == awe_ptr->pts) {
CALL_CONT_LAZY((void*)&thc_yieldto_with_cont, (void*)awe_ptr);
} else {
......@@ -1068,7 +1106,9 @@ void THCYieldTo(awe_t *awe_ptr) {
}
EXPORT_SYMBOL(THCYieldTo);
void THCFinish(void) {
void
LIBASYNC_FUNC_ATTR
THCFinish(void) {
thc_dispatch(PTS());
}
EXPORT_SYMBOL(THCFinish);
......@@ -1089,7 +1129,9 @@ static void thc_suspend_with_cont(void *a, void *arg) {
thc_dispatch(awe->pts);
}
void THCSuspend(awe_t **awe_ptr_ptr) {
void
LIBASYNC_FUNC_ATTR
THCSuspend(awe_t **awe_ptr_ptr) {
CALL_CONT_LAZY(&thc_suspend_with_cont, awe_ptr_ptr);
}
EXPORT_SYMBOL(THCSuspend);
......@@ -1119,7 +1161,9 @@ static void thc_suspendthen_with_cont(void *a, void *arg) {
thc_dispatch(awe->pts);
}
void THCSuspendThen(awe_t **awe_ptr_ptr, THCThenFn_t fn, void *arg) {
void
LIBASYNC_FUNC_ATTR
THCSuspendThen(awe_t **awe_ptr_ptr, THCThenFn_t fn, void *arg) {
then_args_t t;
t.awe_addr = awe_ptr_ptr;
t.then_fn = fn;
......@@ -1149,7 +1193,9 @@ static inline void thc_schedule_local(awe_t *awe) {
DEBUG_AWE(DEBUGPRINTF(DEBUG_AWE_PREFIX "< THCSchedule\n"));
}
void THCSchedule(awe_t *awe) {
void
LIBASYNC_FUNC_ATTR
THCSchedule(awe_t *awe) {
PTState_t *awe_pts;
DEBUG_AWE(DEBUGPRINTF(DEBUG_AWE_PREFIX "> THCSchedule(%p)\n",
awe));
......@@ -1177,7 +1223,9 @@ EXPORT_SYMBOL(THCSchedule);
// Add the supplied AWE to the tail of the dispatch queue (for THCYield)
void THCScheduleBack(awe_t *awe) {
void
LIBASYNC_FUNC_ATTR
THCScheduleBack(awe_t *awe) {
PTState_t *awe_pts = awe->pts;
DEBUG_AWE(DEBUGPRINTF(DEBUG_AWE_PREFIX "> THCSchedule(%p)\n",
awe));
......@@ -1190,7 +1238,9 @@ void THCScheduleBack(awe_t *awe) {
}
EXPORT_SYMBOL(THCScheduleBack);
void THCAddCancelItem(cancel_item_t *ci, THCCancelFn_t fn, void *arg) {
void
LIBASYNC_FUNC_ATTR
THCAddCancelItem(cancel_item_t *ci, THCCancelFn_t fn, void *arg) {
PTState_t *pts = PTS();
finish_t *fb;
DEBUG_CANCEL(DEBUGPRINTF(DEBUG_CANCEL_PREFIX "> THCAddCancelItem(%p)\n", ci));
......@@ -1209,7 +1259,9 @@ void THCAddCancelItem(cancel_item_t *ci, THCCancelFn_t fn, void *arg) {
}
EXPORT_SYMBOL(THCAddCancelItem);
void THCRemoveCancelItem(cancel_item_t *ci) {
void
LIBASYNC_FUNC_ATTR
THCRemoveCancelItem(cancel_item_t *ci) {
PTState_t *pts = PTS();
finish_t *fb = pts->current_fb;
cancel_item_t **cip = &(fb->cancel_item);
......@@ -1230,14 +1282,18 @@ void THCRemoveCancelItem(cancel_item_t *ci) {
}
EXPORT_SYMBOL(THCRemoveCancelItem);
int THCCancelItemRan(cancel_item_t *ci) {
int
LIBASYNC_FUNC_ATTR
THCCancelItemRan(cancel_item_t *ci) {
DEBUG_CANCEL(DEBUGPRINTF(DEBUG_CANCEL_PREFIX "> THCCancelItemRan(%p) = %d\n",
ci, ci->was_run));
return ci->was_run;
}
EXPORT_SYMBOL(THCCancelItemRan);
int THCIsCancelRequested(void) {
int
LIBASYNC_FUNC_ATTR
THCIsCancelRequested(void) {
PTState_t *pts = PTS();
finish_t *fb = pts->current_fb;
int result = fb->cancel_requested;
......@@ -1322,7 +1378,9 @@ static void IdleFn(void *arg) {
#ifndef LINUX_KERNEL
__attribute__((constructor))
#endif
void thc_init(void) {
void
LIBASYNC_FUNC_ATTR
thc_init(void) {
thc_start_rts();
PTS()->idle_fn = IdleFn;
PTS()->idle_args = NULL;
......@@ -1336,7 +1394,9 @@ EXPORT_SYMBOL(thc_init);
#ifndef LINUX_KERNEL
__attribute__((destructor))
#endif
void thc_done(void) {
void
LIBASYNC_FUNC_ATTR
thc_done(void) {
#ifdef LINUX_KERNEL
awe_mapper_uninit();
#endif
......@@ -1344,13 +1404,17 @@ void thc_done(void) {
}
EXPORT_SYMBOL(thc_done);
int thc_global_init(void)
int
LIBASYNC_FUNC_ATTR
thc_global_init(void)
{
return 0; // no-op for now
}
EXPORT_SYMBOL(thc_global_init);
void thc_global_fini(void)
void
LIBASYNC_FUNC_ATTR
thc_global_fini(void)
{
return; // no-op for now
}
......
......@@ -56,9 +56,11 @@ static int poll_recv_predicate(struct fipc_message* msg, void* data)
}
}
int thc_ipc_recv(struct fipc_ring_channel *chnl,
unsigned long msg_id,
struct fipc_message** out_msg)
int
LIBASYNC_FUNC_ATTR
thc_ipc_recv(struct fipc_ring_channel *chnl,
unsigned long msg_id,
struct fipc_message** out_msg)
{
struct predicate_payload payload = {
.expected_msg_id = msg_id
......@@ -93,9 +95,11 @@ int thc_ipc_recv(struct fipc_ring_channel *chnl,
}
EXPORT_SYMBOL(thc_ipc_recv);
int thc_poll_recv_group(struct thc_channel_group* chan_group,
struct thc_channel_group_item** chan_group_item,
struct fipc_message** out_msg)
int
LIBASYNC_FUNC_ATTR
thc_poll_recv_group(struct thc_channel_group* chan_group,
struct thc_channel_group_item** chan_group_item,
struct fipc_message** out_msg)
{
struct thc_channel_group_item* curr_item;
struct fipc_message* recv_msg;
......@@ -118,8 +122,10 @@ int thc_poll_recv_group(struct thc_channel_group* chan_group,
}
EXPORT_SYMBOL(thc_poll_recv_group);
int thc_poll_recv(struct thc_channel_group_item* item,
struct fipc_message** out_msg)
int
LIBASYNC_FUNC_ATTR
thc_poll_recv(struct thc_channel_group_item* item,
struct fipc_message** out_msg)
{
struct predicate_payload payload;
int ret;
......@@ -149,7 +155,9 @@ int thc_poll_recv(struct thc_channel_group_item* item,
}
EXPORT_SYMBOL(thc_poll_recv);
int thc_channel_group_init(struct thc_channel_group* channel_group)
int
LIBASYNC_FUNC_ATTR
thc_channel_group_init(struct thc_channel_group* channel_group)
{
INIT_LIST_HEAD(&(channel_group->head));
channel_group->size = 0;
......@@ -159,7 +167,9 @@ int thc_channel_group_init(struct thc_channel_group* channel_group)
EXPORT_SYMBOL(thc_channel_group_init);
int thc_channel_group_item_add(struct thc_channel_group* channel_group,
int
LIBASYNC_FUNC_ATTR
thc_channel_group_item_add(struct thc_channel_group* channel_group,
struct thc_channel_group_item* item)
{
list_add_tail(&(item->list), &(channel_group->head));
......@@ -170,7 +180,9 @@ int thc_channel_group_item_add(struct thc_channel_group* channel_group,
EXPORT_SYMBOL(thc_channel_group_item_add);
int thc_channel_group_item_get(struct thc_channel_group* channel_group,
int
LIBASYNC_FUNC_ATTR
thc_channel_group_item_get(struct thc_channel_group* channel_group,
int index,
struct thc_channel_group_item **out_item)
{
......
......@@ -42,7 +42,9 @@
//
// Latches
void thc_latch_init(struct thc_latch *l) {
void
LIBASYNC_FUNC_ATTR
thc_latch_init(struct thc_latch *l) {
l->c = 0;
}
EXPORT_SYMBOL(thc_latch_init);
......@@ -51,7 +53,9 @@ EXPORT_SYMBOL(thc_latch_init);
//
// Semaphores
void thc_sem_init(thc_sem_t *s, int val) {
void
LIBASYNC_FUNC_ATTR
thc_sem_init(thc_sem_t *s, int val) {
thc_latch_init(&s->l);
s->val = val;
s->q = NULL;
......@@ -63,7 +67,9 @@ static void thc_sem_p0(void *s) {
thc_latch_release(&sem->l);
}
void thc_sem_p(thc_sem_t *s) {
void
LIBASYNC_FUNC_ATTR
thc_sem_p(thc_sem_t *s) {
thc_latch_acquire(&s->l);
DEBUG_SYNC(DEBUGPRINTF(DEBUG_SYNC_PREFIX "thc_sem_p(%p) %d\n", s, s->val));
if (s->val == 0) {
......@@ -135,7 +141,9 @@ static void thc_sem_p_x_cancel_fn(void *c) {
thc_latch_release(&cinf->sem->l);
}
errval_t thc_sem_p_x(thc_sem_t *s) {
errval_t
LIBASYNC_FUNC_ATTR
thc_sem_p_x(thc_sem_t *s) {
int canceled = 0;
// Return THC_CANCELED if already requested
if (THCIsCancelRequested()) {
......@@ -175,7 +183,9 @@ errval_t thc_sem_p_x(thc_sem_t *s) {
}
EXPORT_SYMBOL(thc_sem_p_x);
void thc_sem_v(thc_sem_t *s) {
void
LIBASYNC_FUNC_ATTR
thc_sem_v(thc_sem_t *s) {
thc_latch_acquire(&s->l);
DEBUG_SYNC(DEBUGPRINTF(DEBUG_SYNC_PREFIX "thc_sem_v(%p)\n", s));
if (s->q != NULL) {
......@@ -203,19 +213,25 @@ EXPORT_SYMBOL(thc_sem_v);
// Locks
#ifndef MUTEX_IS_LATCH
void thc_lock_init(thc_lock_t *l) {
void
LIBASYNC_FUNC_ATTR
thc_lock_init(thc_lock_t *l) {
thc_sem_init(&(l->sem), 1);
}
EXPORT_SYMBOL(thc_lock_init);
void thc_lock_acquire(thc_lock_t *l) {
void
LIBASYNC_FUNC_ATTR
thc_lock_acquire(thc_lock_t *l) {
DEBUG_SYNC(DEBUGPRINTF(DEBUG_SYNC_PREFIX "thc_lock_acquire %p\n", l));
thc_sem_p(&(l->sem));
DEBUG_SYNC(DEBUGPRINTF(DEBUG_SYNC_PREFIX "thc_lock_acquire done\n"));
}
EXPORT_SYMBOL(thc_lock_acquire);
void thc_lock_release(thc_lock_t *l) {
void
LIBASYNC_FUNC_ATTR
thc_lock_release(thc_lock_t *l) {
DEBUG_SYNC(DEBUGPRINTF(DEBUG_SYNC_PREFIX "thc_lock_release %p\n", l));
thc_sem_v(&(l->sem));
DEBUG_SYNC(DEBUGPRINTF(DEBUG_SYNC_PREFIX "thc_lock_release done\n"));
......@@ -227,7 +243,9 @@ EXPORT_SYMBOL(thc_lock_release);
//
// Condition variables
void thc_condvar_init(thc_condvar_t *cv) {
void
LIBASYNC_FUNC_ATTR
thc_condvar_init(thc_condvar_t *cv) {
thc_latch_init(&cv->l);
cv->q = NULL;
}
......@@ -245,7 +263,9 @@ static void thc_condvar_wait0(void *v) {
thc_lock_release(info->lock);
}
void thc_condvar_wait(thc_condvar_t *cv, thc_lock_t *lock) {
void
LIBASYNC_FUNC_ATTR
thc_condvar_wait(thc_condvar_t *cv, thc_lock_t *lock) {
struct thc_waiter w;
thc_condvar_wait0_info_t info;
thc_latch_acquire(&cv->l);
......@@ -310,7 +330,9 @@ static void thc_condvar_wait_x_cancel_fn(void *c) {
thc_latch_release(&cinf->cv->l);
}
errval_t thc_condvar_wait_x(thc_condvar_t *cv, thc_lock_t *lock) {
errval_t
LIBASYNC_FUNC_ATTR
thc_condvar_wait_x(thc_condvar_t *cv, thc_lock_t *lock) {
int canceled = 0;
struct thc_cv_cancel_info cinf;
cancel_item_t ci;
......@@ -351,7 +373,9 @@ errval_t thc_condvar_wait_x(thc_condvar_t *cv, thc_lock_t *lock) {
}
EXPORT_SYMBOL(thc_condvar_wait_x);
void thc_condvar_signal(thc_condvar_t *cv) {
void
LIBASYNC_FUNC_ATTR
thc_condvar_signal(thc_condvar_t *cv) {
thc_latch_acquire(&cv->l);
if (cv->q != NULL) {
struct thc_waiter *w = cv->q;
......@@ -367,7 +391,9 @@ void thc_condvar_signal(thc_condvar_t *cv) {
}
EXPORT_SYMBOL(thc_condvar_signal);
void thc_condvar_broadcast(thc_condvar_t *cv) {
void
LIBASYNC_FUNC_ATTR
thc_condvar_broadcast(thc_condvar_t *cv) {
struct thc_waiter *w;
thc_latch_acquire(&cv->l);
w = cv->q;
......@@ -389,7 +415,9 @@ EXPORT_SYMBOL(thc_condvar_broadcast);
//
// FIFO queue
void thc_queue_init(thc_queue_t *tq) {
void
LIBASYNC_FUNC_ATTR
thc_queue_init(thc_queue_t *tq) {
thc_lock_init(&tq->l);
thc_condvar_init(&tq->cv);
tq->start.bailed = tq->end.bailed = 0;
......@@ -400,8 +428,10 @@ void thc_queue_init(thc_queue_t *tq) {
}
EXPORT_SYMBOL(thc_queue_init);
void thc_queue_enter(thc_queue_t *tq,
thc_queue_entry_t *te) {
void
LIBASYNC_FUNC_ATTR
thc_queue_enter(thc_queue_t *tq,
thc_queue_entry_t *te) {
thc_lock_acquire(&tq->l);
te->bailed = 0;
te->served = 0;
......@@ -413,8 +443,10 @@ void thc_queue_enter(thc_queue_t *tq,
}
EXPORT_SYMBOL(thc_queue_enter);
void thc_queue_await_turn(thc_queue_t *tq,
thc_queue_entry_t *te) {
void
LIBASYNC_FUNC_ATTR
thc_queue_await_turn(thc_queue_t *tq,
thc_queue_entry_t *te) {
thc_lock_acquire(&tq->l);
while (tq->start.next != te) {
thc_condvar_wait(&tq->cv, &tq->l);
......@@ -424,8 +456,10 @@ void thc_queue_await_turn(thc_queue_t *tq,