blob: 80fce0185f210eb5a4b2857b7c27fa35e7f3464c (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
|
/* ISC license. */
#include <errno.h>
#include <skalibs/kolbak.h>
#include <skalibs/unixmessage.h>
int kolbak_enqueue (kolbak_queue_t *q, unixmessage_handler_func_t *f, void *data)
{
register unsigned int newtail = (q->tail + 1) % q->n ;
if (newtail == q->head) return (errno = ENOBUFS, 0) ;
q->x[q->tail].f = f ;
q->x[q->tail].data = data ;
q->tail = newtail ;
return 1 ;
}
|