bufcall(9F) can be used to recover from an allocb(9F) failure. The call syntax is as follows:
bufcall_id_t bufcall(int size, int pri, void(*func)(), long arg);
bufcall(9F) calls (*func)(arg) when a buffer of size bytes is available. When func is called, it has no user context and must return without blocking. Also, there is no guarantee that when func is called, a buffer will still be available.
On success, bufcall returns a nonzero identifier that can be used as a parameter to unbufcall(9F) to cancel the request later. On failure, 0 is returned and the requested function is never called.
![]() | Caution - Care must be taken to avoid deadlock when holding resources while waiting for bufcall to call (*func(arg). bufcall should be used sparingly. |