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.
7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions
10 * 1. Redistributions of source code must retain the above copyright
11 * notice unmodified, this list of conditions, and the following
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.
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.
30 #ifndef _PTHREAD_WORKQUEUE_H
31 #define _PTHREAD_WORKQUEUE_H
34 #define _PWQ_EXPORT __declspec(dllexport)
39 typedef struct _pthread_workqueue * pthread_workqueue_t;
40 typedef void * pthread_workitem_handle_t;
42 /* Pad size to 64 bytes. */
48 } pthread_workqueue_attr_t;
50 /* Work queue priority attributes. */
51 #define WORKQ_HIGH_PRIOQUEUE 0
52 #define WORKQ_DEFAULT_PRIOQUEUE 1
53 #define WORKQ_LOW_PRIOQUEUE 2
55 #if defined(__cplusplus)
59 int _PWQ_EXPORT pthread_workqueue_create_np(pthread_workqueue_t * workqp,
60 const pthread_workqueue_attr_t * attr);
62 int _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);
66 int _PWQ_EXPORT pthread_workqueue_attr_init_np(pthread_workqueue_attr_t * attrp);
68 int _PWQ_EXPORT pthread_workqueue_attr_destroy_np(pthread_workqueue_attr_t * attr);
70 int _PWQ_EXPORT pthread_workqueue_attr_setqueuepriority_np(pthread_workqueue_attr_t * attr,
73 int _PWQ_EXPORT pthread_workqueue_attr_getovercommit_np(
74 const pthread_workqueue_attr_t * attr, int * ocommp);
76 int _PWQ_EXPORT pthread_workqueue_attr_setovercommit_np(pthread_workqueue_attr_t * attr,
79 int _PWQ_EXPORT pthread_workqueue_requestconcurrency_np(pthread_workqueue_t workq,
80 int queue, int request_concurrency);
82 int _PWQ_EXPORT pthread_workqueue_getovercommit_np(pthread_workqueue_t workq,
83 unsigned int *ocommp);
85 void _PWQ_EXPORT pthread_workqueue_main_np(void);
88 int _PWQ_EXPORT pthread_workqueue_init_np(void);
91 /* NOTE: this is not part of the Darwin API */
92 unsigned long _PWQ_EXPORT pthread_workqueue_peek_np(const char *);
94 #if defined(__cplusplus)
100 #endif /* _PTHREAD_WORKQUEUE_H */