Module Simple_httpd.MutexSource

Module providing Mutex thats works with our Async module above

Sourcetype t

Simple_httpd notion of mutex. You must be careful with server wide mutex: a DoS attack could try to hold such a mutex. A mutex per session may be a good idea. A mutex per client is useless (client are treated sequentially, unless you use spanw or websocket (that uses spawn)).

Note: they are implemented using Linux eventfd

Sourceval create : unit -> t
Sourceval try_lock : t -> bool
Sourceval lock : t -> unit
Sourceval unlock : t -> unit
Sourceval try_unlock : t -> unit

unlock if locked by you, useful if you may have closed the client

Sourceval use : t -> (unit -> 'a) -> 'a
Sourceval delete : t -> unit