1266612Smav/*
2266612Smav * CDDL HEADER START
3219089Spjd *
4266612Smav * The contents of this file are subject to the terms of the
5266612Smav * Common Development and Distribution License (the "License").
6266612Smav * You may not use this file except in compliance with the License.
7219089Spjd *
8266612Smav * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9266612Smav * or http://www.opensolaris.org/os/licensing.
10266612Smav * See the License for the specific language governing permissions
11266612Smav * and limitations under the License.
12219089Spjd *
13266612Smav * When distributing Covered Code, include this CDDL HEADER in each
14266612Smav * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15266612Smav * If applicable, add the following below this CDDL HEADER, with the
16266612Smav * fields enclosed by brackets "[]" replaced with your own identifying
17266612Smav * information: Portions Copyright [yyyy] [name of copyright owner]
18266612Smav *
19266612Smav * CDDL HEADER END
20266612Smav */
21266612Smav
22266612Smav/*
23266612Smav * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
24266612Smav * Use is subject to license terms.
25266612Smav */
26266612Smav
27266612Smav/*
28219089Spjd * $FreeBSD$
29219089Spjd */
30219089Spjd
31266612Smav#ifndef	_THREAD_POOL_H_
32266612Smav#define	_THREAD_POOL_H_
33219089Spjd
34266612Smav#pragma ident	"%Z%%M%	%I%	%E% SMI"
35219089Spjd
36266612Smav#include <sys/types.h>
37266612Smav#include <thread.h>
38266612Smav#include <pthread.h>
39219089Spjd
40266612Smav#ifdef	__cplusplus
41266612Smavextern "C" {
42266612Smav#endif
43266612Smav
44266612Smavtypedef	struct tpool tpool_t;	/* opaque thread pool descriptor */
45266612Smav
46266612Smav#if defined(__STDC__)
47266612Smav
48266612Smavextern	tpool_t	*tpool_create(uint_t min_threads, uint_t max_threads,
49266612Smav			uint_t linger, pthread_attr_t *attr);
50266612Smavextern	int	tpool_dispatch(tpool_t *tpool,
51266612Smav			void (*func)(void *), void *arg);
52266612Smavextern	void	tpool_destroy(tpool_t *tpool);
53266612Smavextern	void	tpool_abandon(tpool_t *tpool);
54266612Smavextern	void	tpool_wait(tpool_t *tpool);
55266612Smavextern	void	tpool_suspend(tpool_t *tpool);
56266612Smavextern	int	tpool_suspended(tpool_t *tpool);
57266612Smavextern	void	tpool_resume(tpool_t *tpool);
58266612Smavextern	int	tpool_member(tpool_t *tpool);
59266612Smav
60266612Smav#else	/* Non ANSI */
61266612Smav
62266612Smavextern	tpool_t	*tpool_create();
63266612Smavextern	int	tpool_dispatch();
64266612Smavextern	void	tpool_destroy();
65266612Smavextern	void	tpool_abandon();
66266612Smavextern	void	tpool_wait();
67266612Smavextern	void	tpool_suspend();
68266612Smavextern	int	tpool_suspended();
69266612Smavextern	void	tpool_resume();
70266612Smavextern	int	tpool_member();
71266612Smav
72266612Smav#endif	/* __STDC__ */
73266612Smav
74266612Smav#ifdef	__cplusplus
75266612Smav}
76266612Smav#endif
77266612Smav
78266612Smav#endif	/* _THREAD_POOL_H_ */
79