134709573Sraf /* 234709573Sraf * CDDL HEADER START 334709573Sraf * 434709573Sraf * The contents of this file are subject to the terms of the 534709573Sraf * Common Development and Distribution License (the "License"). 634709573Sraf * You may not use this file except in compliance with the License. 734709573Sraf * 834709573Sraf * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 934709573Sraf * or http://www.opensolaris.org/os/licensing. 1034709573Sraf * See the License for the specific language governing permissions 1134709573Sraf * and limitations under the License. 1234709573Sraf * 1334709573Sraf * When distributing Covered Code, include this CDDL HEADER in each 1434709573Sraf * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 1534709573Sraf * If applicable, add the following below this CDDL HEADER, with the 1634709573Sraf * fields enclosed by brackets "[]" replaced with your own identifying 1734709573Sraf * information: Portions Copyright [yyyy] [name of copyright owner] 1834709573Sraf * 1934709573Sraf * CDDL HEADER END 2034709573Sraf */ 2134709573Sraf 2234709573Sraf /* 2334709573Sraf * Copyright 2006 Sun Microsystems, Inc. All rights reserved. 2434709573Sraf * Use is subject to license terms. 2534709573Sraf */ 2634709573Sraf 2734709573Sraf #ifndef _THREAD_POOL_H_ 2834709573Sraf #define _THREAD_POOL_H_ 2934709573Sraf 3034709573Sraf #include <sys/types.h> 3134709573Sraf #include <thread.h> 3234709573Sraf #include <pthread.h> 3334709573Sraf 3434709573Sraf #ifdef __cplusplus 3534709573Sraf extern "C" { 3634709573Sraf #endif 3734709573Sraf 3834709573Sraf typedef struct tpool tpool_t; /* opaque thread pool descriptor */ 3934709573Sraf 4034709573Sraf #if defined(__STDC__) 4134709573Sraf 4234709573Sraf extern tpool_t *tpool_create(uint_t min_threads, uint_t max_threads, 4334709573Sraf uint_t linger, pthread_attr_t *attr); 4434709573Sraf extern int tpool_dispatch(tpool_t *tpool, 4534709573Sraf void (*func)(void *), void *arg); 4634709573Sraf extern void tpool_destroy(tpool_t *tpool); 4734709573Sraf extern void tpool_abandon(tpool_t *tpool); 4834709573Sraf extern void tpool_wait(tpool_t *tpool); 4934709573Sraf extern void tpool_suspend(tpool_t *tpool); 5034709573Sraf extern int tpool_suspended(tpool_t *tpool); 5134709573Sraf extern void tpool_resume(tpool_t *tpool); 5234709573Sraf extern int tpool_member(tpool_t *tpool); 5334709573Sraf 5434709573Sraf #else /* Non ANSI */ 5534709573Sraf 5634709573Sraf extern tpool_t *tpool_create(); 5734709573Sraf extern int tpool_dispatch(); 5834709573Sraf extern void tpool_destroy(); 5934709573Sraf extern void tpool_abandon(); 6034709573Sraf extern void tpool_wait(); 6134709573Sraf extern void tpool_suspend(); 6234709573Sraf extern int tpool_suspended(); 6334709573Sraf extern void tpool_resume(); 6434709573Sraf extern int tpool_member(); 6534709573Sraf 6634709573Sraf #endif /* __STDC__ */ 6734709573Sraf 6834709573Sraf #ifdef __cplusplus 6934709573Sraf } 7034709573Sraf #endif 7134709573Sraf 7234709573Sraf #endif /* _THREAD_POOL_H_ */ 73