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