this repo has no description
1/*-
2 * Copyright (c) 2010, Mark Heily <mark@heily.com>
3 * Copyright (c) 2009, Stacey Son <sson@freebsd.org>
4 * Copyright (c) 2000-2008, Apple Inc.
5 * All rights reserved.
6 *
7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions
9 * are met:
10 * 1. Redistributions of source code must retain the above copyright
11 * notice unmodified, this list of conditions, and the following
12 * disclaimer.
13 * 2. Redistributions in binary form must reproduce the above copyright
14 * notice, this list of conditions and the following disclaimer in the
15 * documentation and/or other materials provided with the distribution.
16 *
17 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
18 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
19 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
20 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
21 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
22 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
26 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 *
28 */
29
30#ifndef _PTHREAD_WORKQUEUE_H
31#define _PTHREAD_WORKQUEUE_H
32
33#if _WIN32
34#define _PWQ_EXPORT __declspec(dllexport)
35#else
36#define _PWQ_EXPORT
37#endif
38
39typedef struct _pthread_workqueue * pthread_workqueue_t;
40typedef void * pthread_workitem_handle_t;
41
42/* Pad size to 64 bytes. */
43typedef struct {
44 unsigned int sig;
45 int queueprio;
46 int overcommit;
47 unsigned int pad[13];
48} pthread_workqueue_attr_t;
49
50/* Work queue priority attributes. */
51#define WORKQ_HIGH_PRIOQUEUE 0
52#define WORKQ_DEFAULT_PRIOQUEUE 1
53#define WORKQ_LOW_PRIOQUEUE 2
54
55#if defined(__cplusplus)
56 extern "C" {
57#endif
58
59int _PWQ_EXPORT pthread_workqueue_create_np(pthread_workqueue_t * workqp,
60 const pthread_workqueue_attr_t * attr);
61
62int _PWQ_EXPORT pthread_workqueue_additem_np(pthread_workqueue_t workq,
63 void (*workitem_func)(void *), void * workitem_arg,
64 pthread_workitem_handle_t * itemhandlep, unsigned int *gencountp);
65
66int _PWQ_EXPORT pthread_workqueue_attr_init_np(pthread_workqueue_attr_t * attrp);
67
68int _PWQ_EXPORT pthread_workqueue_attr_destroy_np(pthread_workqueue_attr_t * attr);
69
70int _PWQ_EXPORT pthread_workqueue_attr_setqueuepriority_np(pthread_workqueue_attr_t * attr,
71 int qprio);
72
73int _PWQ_EXPORT pthread_workqueue_attr_getovercommit_np(
74 const pthread_workqueue_attr_t * attr, int * ocommp);
75
76int _PWQ_EXPORT pthread_workqueue_attr_setovercommit_np(pthread_workqueue_attr_t * attr,
77 int ocomm);
78
79int _PWQ_EXPORT pthread_workqueue_requestconcurrency_np(pthread_workqueue_t workq,
80 int queue, int request_concurrency);
81
82int _PWQ_EXPORT pthread_workqueue_getovercommit_np(pthread_workqueue_t workq,
83 unsigned int *ocommp);
84
85void _PWQ_EXPORT pthread_workqueue_main_np(void);
86
87#ifdef MAKE_STATIC
88int _PWQ_EXPORT pthread_workqueue_init_np(void);
89#endif
90
91/* NOTE: this is not part of the Darwin API */
92unsigned long _PWQ_EXPORT pthread_workqueue_peek_np(const char *);
93
94#if defined(__cplusplus)
95 }
96#endif
97
98#undef _PWQ_EXPORT
99
100#endif /* _PTHREAD_WORKQUEUE_H */