/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License (the "License").
* You may not use this file except in compliance with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/
/*
* Copyright 2014 Garrett D'Amore <garrett@damore.org>
*
* Copyright 2007 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#ifndef _THREAD_H
#define _THREAD_H
/*
* thread.h:
* definitions needed to use the thread interface except synchronization.
* use <synch.h> for thread synchronization.
*/
#ifndef _ASM
#include <synch.h>
#endif /* _ASM */
#ifdef __cplusplus
extern "C" {
#endif
#ifndef _ASM
typedef unsigned int thread_t;
typedef unsigned int thread_key_t;
extern int thr_create(void *, size_t, void *(*)(void *), void *, long,
thread_t *);
extern int thr_setconcurrency(int);
extern int thr_getconcurrency(void);
extern void thr_exit(void *) __NORETURN;
/*
* the definition of thr_sigsetmask() is not strict ansi-c since sigset_t is
* not in the strict ansi-c name space. Hence, include the prototype for
* thr_sigsetmask() only if strict ansi-c conformance is not turned on.
*/
#if !defined(_STRICT_STDC) || defined(__EXTENSIONS__)
#endif
/*
* the definition of thr_stksegment() is not strict ansi-c since stack_t is
* not in the strict ansi-c name space. Hence, include the prototype for
* thr_stksegment() only if strict ansi-c conformance is not turned on.
*/
#if !defined(_STRICT_STDC) || defined(__EXTENSIONS__)
extern int thr_stksegment(stack_t *);
#endif
extern int thr_main(void);
extern int thr_suspend(thread_t);
extern int thr_continue(thread_t);
extern void thr_yield(void);
extern int thr_setprio(thread_t, int);
extern int thr_getprio(thread_t, int *);
extern int thr_keycreate(thread_key_t *, void(*)(void *));
extern int thr_keycreate_once(thread_key_t *, void(*)(void *));
extern int thr_setspecific(thread_key_t, void *);
extern int thr_getspecific(thread_key_t, void **);
extern size_t thr_min_stack(void);
#endif /* _ASM */
/*
* thread flags (one word bit mask)
*/
/*
* POSIX.1c Note:
* THR_BOUND is defined same as PTHREAD_SCOPE_SYSTEM in <pthread.h>
* THR_DETACHED is defined same as PTHREAD_CREATE_DETACHED in <pthread.h>
* Any changes in these definitions should be reflected in <pthread.h>
*/
/*
* The key to be created by thr_keycreate_once()
* must be statically initialized with THR_ONCE_KEY.
* This must be the same as PTHREAD_ONCE_KEY_NP in <pthread.h>
*/
/*
* The available register states returned by thr_getstate().
*/
#define TRS_VALID 0
#ifdef __cplusplus
}
#endif
#endif /* _THREAD_H */