Changeset View
Changeset View
Standalone View
Standalone View
sys/sys/epoch.h
Show First 20 Lines • Show All 98 Lines • ▼ Show 20 Lines | |||||
*/ | */ | ||||
/* Network preemptible epoch, declared in sys/net/if.c. */ | /* Network preemptible epoch, declared in sys/net/if.c. */ | ||||
extern epoch_t net_epoch_preempt; | extern epoch_t net_epoch_preempt; | ||||
#define NET_EPOCH_ENTER(et) epoch_enter_preempt(net_epoch_preempt, &(et)) | #define NET_EPOCH_ENTER(et) epoch_enter_preempt(net_epoch_preempt, &(et)) | ||||
#define NET_EPOCH_EXIT(et) epoch_exit_preempt(net_epoch_preempt, &(et)) | #define NET_EPOCH_EXIT(et) epoch_exit_preempt(net_epoch_preempt, &(et)) | ||||
#define NET_EPOCH_WAIT() epoch_wait_preempt(net_epoch_preempt) | #define NET_EPOCH_WAIT() epoch_wait_preempt(net_epoch_preempt) | ||||
#define NET_EPOCH_CALL(f, c) epoch_call(net_epoch_preempt, (f), (c)) | #define NET_EPOCH_CALL(f, c) epoch_call(net_epoch_preempt, (f), (c)) | ||||
#define NET_EPOCH_ASSERT() MPASS(in_epoch(net_epoch_preempt)) | #define NET_EPOCH_ASSERT() MPASS(in_epoch(net_epoch_preempt)) | ||||
#define NET_EPOCH_WRAP_RET(fn, arg) ({ \ | |||||
struct epoch_tracker __et; \ | |||||
__typeof(fn arg) __ret; \ | |||||
NET_EPOCH_ENTER(__et); \ | |||||
__ret = fn arg; \ | |||||
NET_EPOCH_EXIT(__et); \ | |||||
__ret; \ | |||||
}) | |||||
#define NET_EPOCH_WRAP(fn, arg) do { \ | |||||
struct epoch_tracker __et; \ | |||||
NET_EPOCH_ENTER(__et); \ | |||||
fn arg; \ | |||||
NET_EPOCH_EXIT(__et); \ | |||||
} while (0) | |||||
#endif /* _KERNEL */ | #endif /* _KERNEL */ | ||||
#endif /* _SYS_EPOCH_H_ */ | #endif /* _SYS_EPOCH_H_ */ |