xref: /onnv-gate/usr/src/lib/libc/inc/thread_pool.h (revision 2248:4609e8bb25ad)
1*2248Sraf /*
2*2248Sraf  * CDDL HEADER START
3*2248Sraf  *
4*2248Sraf  * The contents of this file are subject to the terms of the
5*2248Sraf  * Common Development and Distribution License (the "License").
6*2248Sraf  * You may not use this file except in compliance with the License.
7*2248Sraf  *
8*2248Sraf  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9*2248Sraf  * or http://www.opensolaris.org/os/licensing.
10*2248Sraf  * See the License for the specific language governing permissions
11*2248Sraf  * and limitations under the License.
12*2248Sraf  *
13*2248Sraf  * When distributing Covered Code, include this CDDL HEADER in each
14*2248Sraf  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15*2248Sraf  * If applicable, add the following below this CDDL HEADER, with the
16*2248Sraf  * fields enclosed by brackets "[]" replaced with your own identifying
17*2248Sraf  * information: Portions Copyright [yyyy] [name of copyright owner]
18*2248Sraf  *
19*2248Sraf  * CDDL HEADER END
20*2248Sraf  */
21*2248Sraf 
22*2248Sraf /*
23*2248Sraf  * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
24*2248Sraf  * Use is subject to license terms.
25*2248Sraf  */
26*2248Sraf 
27*2248Sraf #ifndef	_THREAD_POOL_H_
28*2248Sraf #define	_THREAD_POOL_H_
29*2248Sraf 
30*2248Sraf #pragma ident	"%Z%%M%	%I%	%E% SMI"
31*2248Sraf 
32*2248Sraf #include <sys/types.h>
33*2248Sraf #include <thread.h>
34*2248Sraf #include <pthread.h>
35*2248Sraf 
36*2248Sraf #ifdef	__cplusplus
37*2248Sraf extern "C" {
38*2248Sraf #endif
39*2248Sraf 
40*2248Sraf typedef	struct tpool tpool_t;	/* opaque thread pool descriptor */
41*2248Sraf 
42*2248Sraf #if defined(__STDC__)
43*2248Sraf 
44*2248Sraf extern	tpool_t	*tpool_create(uint_t min_threads, uint_t max_threads,
45*2248Sraf 			uint_t linger, pthread_attr_t *attr);
46*2248Sraf extern	int	tpool_dispatch(tpool_t *tpool,
47*2248Sraf 			void (*func)(void *), void *arg);
48*2248Sraf extern	void	tpool_destroy(tpool_t *tpool);
49*2248Sraf extern	void	tpool_abandon(tpool_t *tpool);
50*2248Sraf extern	void	tpool_wait(tpool_t *tpool);
51*2248Sraf extern	void	tpool_suspend(tpool_t *tpool);
52*2248Sraf extern	int	tpool_suspended(tpool_t *tpool);
53*2248Sraf extern	void	tpool_resume(tpool_t *tpool);
54*2248Sraf extern	int	tpool_member(tpool_t *tpool);
55*2248Sraf 
56*2248Sraf #else	/* Non ANSI */
57*2248Sraf 
58*2248Sraf extern	tpool_t	*tpool_create();
59*2248Sraf extern	int	tpool_dispatch();
60*2248Sraf extern	void	tpool_destroy();
61*2248Sraf extern	void	tpool_abandon();
62*2248Sraf extern	void	tpool_wait();
63*2248Sraf extern	void	tpool_suspend();
64*2248Sraf extern	int	tpool_suspended();
65*2248Sraf extern	void	tpool_resume();
66*2248Sraf extern	int	tpool_member();
67*2248Sraf 
68*2248Sraf #endif	/* __STDC__ */
69*2248Sraf 
70*2248Sraf #ifdef	__cplusplus
71*2248Sraf }
72*2248Sraf #endif
73*2248Sraf 
74*2248Sraf #endif	/* _THREAD_POOL_H_ */
75