2 * Provides a fast serialization facility that will serialize across blocking
3 * conditions. This facility is very similar to a lock but much faster for
4 * the common case. It utilizes the atomic_intr_*() functions to acquire
5 * and release the serializer and token functions to block.
7 * This API is designed to be used whenever low level serialization is
8 * required. Unlike tokens this serialization is not safe from deadlocks
9 * nor is it recursive, and care must be taken when using it.
11 * $DragonFly: src/sys/sys/serialize.h,v 1.1 2005/05/24 20:58:44 dillon Exp $
14 #ifndef _SYS_SERIALIZE_H_
15 #define _SYS_SERIALIZE_H_
17 #ifndef _MACHINE_ATOMIC_H_
18 #include <machine/atomic.h>
23 struct lwkt_serialize {
24 atomic_intr_t interlock;
25 struct thread *last_td;
28 typedef struct lwkt_serialize *lwkt_serialize_t;
30 void lwkt_serialize_init(lwkt_serialize_t);
31 void lwkt_serialize_enter(lwkt_serialize_t);
32 void lwkt_serialize_exit(lwkt_serialize_t);
33 void lwkt_serialize_handler_disable(lwkt_serialize_t);
34 void lwkt_serialize_handler_enable(lwkt_serialize_t);
35 void lwkt_serialize_handler_call(lwkt_serialize_t, void (*)(void *), void *);