2 * Copyright (c) 2007 Apple, Inc. All rights reserved.
4 * @APPLE_LICENSE_HEADER_START@
6 * This file contains Original Code and/or Modifications of Original Code
7 * as defined in and that are subject to the Apple Public Source License
8 * Version 2.0 (the 'License'). You may not use this file except in
9 * compliance with the License. Please obtain a copy of the License at
10 * http://www.opensource.apple.com/apsl/ and read it before using this
13 * The Original Code and all software distributed under the License are
14 * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
15 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
16 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
17 * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
18 * Please see the License for the specific language governing rights and
19 * limitations under the License.
21 * @APPLE_LICENSE_HEADER_END@
23 /* pthread workqueue defns */
25 #ifndef _POSIX_PTHREAD_WORKQUEUE_H
26 #define _POSIX_PTHREAD_WORKQUEUE_H
28 #include <sys/cdefs.h>
32 #define __PTHREAD_WORKQ_SIZE__ 128
33 #define __PTHREAD_WORKQ_ATTR_SIZE__ 60
35 #define PTHEAD_WRKQUEUE_SIG 0xBEBEBEBE
36 #define PTHEAD_WRKQUEUE_ATTR_SIG 0xBEBEBEBE
39 typedef struct { unsigned int sig
; char opaque
[__PTHREAD_WORKQ_SIZE__
];} *pthread_workqueue_t
;
40 typedef struct { unsigned int sig
; char opaque
[__PTHREAD_WORKQ_ATTR_SIZE__
]; } pthread_workqueue_attr_t
;
42 typedef void * pthread_workitem_handle_t
;
45 int pthread_workqueue_init_np(void);
46 int pthread_workqueue_attr_init_np(pthread_workqueue_attr_t
* attr
);
47 int pthread_workqueue_attr_destroy_np(pthread_workqueue_attr_t
* attr
);
48 int pthread_workqueue_attr_getqueuepriority_np(const pthread_workqueue_attr_t
* attr
, int * qprio
);
49 int pthread_workqueue_attr_setqueuepriority_np(pthread_workqueue_attr_t
* attr
, int qprio
);
52 /* Following attributes not supported yet */
53 int pthread_workqueue_attr_getstacksize_np(const pthread_workqueue_attr_t
* attr
, size_t * stacksizep
);
54 int pthread_workqueue_attr_setstacksize_np(pthread_workqueue_attr_t
* attr
, size_t stacksize
);
55 int pthread_workqueue_attr_getthreadtimeshare_np(const pthread_workqueue_attr_t
* attr
, int * istimesahrep
);
56 int pthread_workqueue_attr_settthreadtimeshare_np(pthread_workqueue_attr_t
* attr
, int istimeshare
);
57 int pthread_workqueue_attr_getthreadimportance_np(const pthread_workqueue_attr_t
* attr
, int * importancep
);
58 int pthread_workqueue_attr_settthreadimportance_np(pthread_workqueue_attr_t
* attr
, int importance
);
59 int pthread_workqueue_attr_getthreadaffinity_np(const pthread_workqueue_attr_t
* attr
, int * affinityp
);
60 int pthread_workqueue_attr_settthreadaffinity_np(pthread_workqueue_attr_t
* attr
, int affinity
);
63 int pthread_workqueue_create_np(pthread_workqueue_t
* workqp
, const pthread_workqueue_attr_t
* attr
);
64 int pthread_workqueue_destroy_np(pthread_workqueue_t workq
, void (* callback_func
)(pthread_workqueue_t
, void *), void * callback_arg
);
65 int pthread_workqueue_additem_np(pthread_workqueue_t workq
, void ( *workitem_func
)(void *), void * workitem_arg
, pthread_workitem_handle_t
* itemhandlep
);
66 int pthread_workqueue_removeitem_np(pthread_workqueue_t workq
, pthread_workitem_handle_t itemhandle
);
67 int pthread_workqueue_addbarrier_np(pthread_workqueue_t workq
, void (* callback_func
)(pthread_workqueue_t
, void *), void * callback_arg
, int waitforcallback
, pthread_workitem_handle_t
*itemhandlep
);
68 int pthread_workqueue_suspend_np(pthread_workqueue_t workq
);
69 int pthread_workqueue_resume_np(pthread_workqueue_t workq
);
73 #endif /* _POSIX_PTHREAD_WORKQUEUE_H */