Merge branch 'merges' of git://repo.or.cz/unleashed into merges
[unleashed.git] / usr / src / lib / mergeq / workq.h
blob20cfec4a953a9ab472fb2494ba503a5e168450bc
1 /*
2 * This file and its contents are supplied under the terms of the
3 * Common Development and Distribution License ("CDDL"), version 1.0.
4 * You may only use this file in accordance with the terms of version
5 * 1.0 of the CDDL.
7 * A full copy of the text of the CDDL should have accompanied this
8 * source. A copy of the CDDL is also available via the Internet at
9 * http://www.illumos.org/license/CDDL.
13 * Copyright 2015 Joyent, Inc.
16 #ifndef _WORKQ_H
17 #define _WORKQ_H
20 * workq library routines
23 #include <sys/types.h>
24 #include <stdint.h>
26 #ifdef __cplusplus
27 extern "C" {
28 #endif
30 typedef struct workq workq_t;
31 typedef int (workq_proc_f)(void *, void *);
33 extern int workq_init(workq_t **, uint_t);
34 extern void workq_fini(workq_t *);
36 extern int workq_add(workq_t *, void *);
38 #define WORKQ_ERROR (-1)
39 #define WORKQ_UERROR (-2)
40 extern int workq_work(workq_t *, workq_proc_f *, void *, int *);
43 * Routines consumers need to implement
45 extern void *workq_alloc(size_t);
46 extern void workq_free(void *, size_t);
48 #ifdef __cplusplus
50 #endif
52 #endif /* _WORKQ_H */