Relicense Sortix to the ISC license.
I hereby relicense all my work on Sortix under the ISC license as below.
All Sortix contributions by other people are already under this license,
are not substantial enough to be copyrightable, or have been removed.
All imported code from other projects is compatible with this license.
All GPL licensed code from other projects had previously been removed.
Copyright 2011-2016 Jonas 'Sortie' Termansen and contributors.
Permission to use, copy, modify, and distribute this software for any
purpose with or without fee is hereby granted, provided that the above
copyright notice and this permission notice appear in all copies.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
2016-03-02 23:38:16 +01:00
|
|
|
/*
|
2021-02-06 21:23:43 +01:00
|
|
|
* Copyright (c) 2013, 2014, 2017, 2021 Jonas 'Sortie' Termansen.
|
Relicense Sortix to the ISC license.
I hereby relicense all my work on Sortix under the ISC license as below.
All Sortix contributions by other people are already under this license,
are not substantial enough to be copyrightable, or have been removed.
All imported code from other projects is compatible with this license.
All GPL licensed code from other projects had previously been removed.
Copyright 2011-2016 Jonas 'Sortie' Termansen and contributors.
Permission to use, copy, modify, and distribute this software for any
purpose with or without fee is hereby granted, provided that the above
copyright notice and this permission notice appear in all copies.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
2016-03-02 23:38:16 +01:00
|
|
|
*
|
|
|
|
* Permission to use, copy, modify, and distribute this software for any
|
|
|
|
* purpose with or without fee is hereby granted, provided that the above
|
|
|
|
* copyright notice and this permission notice appear in all copies.
|
|
|
|
*
|
|
|
|
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
|
|
|
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
|
|
|
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
|
|
|
* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
|
|
|
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
|
|
|
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
|
|
|
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
|
|
|
*
|
|
|
|
* __/pthread.h
|
|
|
|
* Thread API.
|
|
|
|
*/
|
2013-08-31 13:15:53 +02:00
|
|
|
|
2022-07-08 01:09:15 +02:00
|
|
|
#ifndef _INCLUDE____PTHREAD_H
|
|
|
|
#define _INCLUDE____PTHREAD_H
|
2013-08-31 13:15:53 +02:00
|
|
|
|
|
|
|
#include <sys/cdefs.h>
|
|
|
|
|
|
|
|
#include <sys/__/types.h>
|
|
|
|
|
2015-05-13 18:11:02 +02:00
|
|
|
#ifdef __cplusplus
|
|
|
|
extern "C" {
|
|
|
|
#endif
|
2013-08-31 13:15:53 +02:00
|
|
|
|
2016-02-28 13:03:24 +01:00
|
|
|
#if defined(__is_sortix_libc)
|
2013-09-03 15:06:16 +02:00
|
|
|
typedef struct
|
|
|
|
{
|
2013-09-03 15:08:38 +02:00
|
|
|
__SIZE_TYPE__ stack_size;
|
2014-01-09 23:48:43 +01:00
|
|
|
int detach_state;
|
2013-09-03 15:06:16 +02:00
|
|
|
} __pthread_attr_t;
|
|
|
|
#else
|
|
|
|
typedef struct
|
|
|
|
{
|
2013-09-03 15:08:38 +02:00
|
|
|
__SIZE_TYPE__ __pthread_stack_size;
|
2014-01-09 23:48:43 +01:00
|
|
|
int __pthread_detached_state;
|
2013-09-03 15:06:16 +02:00
|
|
|
} __pthread_attr_t;
|
|
|
|
#endif
|
2013-08-31 13:15:53 +02:00
|
|
|
|
|
|
|
typedef int __pthread_barrier_t;
|
|
|
|
|
|
|
|
typedef int __pthread_barrierattr_t;
|
|
|
|
|
2021-02-06 21:23:43 +01:00
|
|
|
typedef __SIZE_TYPE__ __pthread_key_t;
|
|
|
|
|
2016-02-28 13:03:24 +01:00
|
|
|
#if defined(__is_sortix_libc)
|
2013-09-03 15:17:13 +02:00
|
|
|
typedef struct
|
|
|
|
{
|
2021-02-06 21:23:43 +01:00
|
|
|
int lock;
|
|
|
|
unsigned long type;
|
|
|
|
unsigned long owner;
|
|
|
|
unsigned long recursion;
|
|
|
|
} __pthread_mutex_t;
|
2013-09-03 15:17:13 +02:00
|
|
|
#else
|
|
|
|
typedef struct
|
|
|
|
{
|
2021-02-06 21:23:43 +01:00
|
|
|
int __pthread_lock;
|
|
|
|
unsigned long __pthread_type;
|
|
|
|
unsigned long __pthread_owner;
|
|
|
|
unsigned long __pthread_recursion;
|
|
|
|
} __pthread_mutex_t;
|
2013-09-03 15:17:13 +02:00
|
|
|
#endif
|
2013-08-31 13:15:53 +02:00
|
|
|
|
2016-02-28 13:03:24 +01:00
|
|
|
#if defined(__is_sortix_libc)
|
2013-09-03 15:51:15 +02:00
|
|
|
typedef struct
|
|
|
|
{
|
2021-02-06 21:23:43 +01:00
|
|
|
int type;
|
|
|
|
} __pthread_mutexattr_t;
|
2013-09-03 15:51:15 +02:00
|
|
|
#else
|
|
|
|
typedef struct
|
|
|
|
{
|
2021-02-06 21:23:43 +01:00
|
|
|
int __pthread_type;
|
|
|
|
} __pthread_mutexattr_t;
|
2013-09-03 15:51:15 +02:00
|
|
|
#endif
|
2013-08-31 13:15:53 +02:00
|
|
|
|
2016-02-28 13:03:24 +01:00
|
|
|
#if defined(__is_sortix_libc)
|
2013-08-31 13:18:20 +02:00
|
|
|
typedef struct
|
|
|
|
{
|
2021-02-06 21:23:43 +01:00
|
|
|
__pthread_mutex_t lock;
|
|
|
|
struct pthread_cond_elem* first;
|
|
|
|
struct pthread_cond_elem* last;
|
|
|
|
__clockid_t clock;
|
|
|
|
} __pthread_cond_t;
|
2013-08-31 13:18:20 +02:00
|
|
|
#else
|
|
|
|
typedef struct
|
|
|
|
{
|
2021-02-06 21:23:43 +01:00
|
|
|
__pthread_mutex_t __pthread_lock;
|
|
|
|
void* __pthread_first;
|
|
|
|
void* __pthread_last;
|
|
|
|
__clockid_t __pthread_clock;
|
|
|
|
} __pthread_cond_t;
|
2013-08-31 13:18:20 +02:00
|
|
|
#endif
|
2013-08-31 13:15:53 +02:00
|
|
|
|
2016-02-28 13:03:24 +01:00
|
|
|
#if defined(__is_sortix_libc)
|
2013-09-03 14:51:44 +02:00
|
|
|
typedef struct
|
|
|
|
{
|
2021-02-06 21:23:43 +01:00
|
|
|
__clockid_t clock;
|
|
|
|
} __pthread_condattr_t;
|
2013-09-03 14:51:44 +02:00
|
|
|
#else
|
|
|
|
typedef struct
|
|
|
|
{
|
2021-02-06 21:23:43 +01:00
|
|
|
__clockid_t __pthread_clock;
|
|
|
|
} __pthread_condattr_t;
|
2013-09-03 14:51:44 +02:00
|
|
|
#endif
|
2013-08-31 13:15:53 +02:00
|
|
|
|
2016-02-28 13:03:24 +01:00
|
|
|
#if defined(__is_sortix_libc)
|
2014-01-10 16:01:28 +01:00
|
|
|
typedef struct
|
|
|
|
{
|
|
|
|
__pthread_mutex_t lock;
|
|
|
|
int executed;
|
|
|
|
} __pthread_once_t;
|
|
|
|
#else
|
|
|
|
typedef struct
|
|
|
|
{
|
|
|
|
__pthread_mutex_t __pthread_lock;
|
|
|
|
int __pthread_executed;
|
|
|
|
} __pthread_once_t;
|
|
|
|
#endif
|
2013-08-31 13:15:53 +02:00
|
|
|
|
2016-02-28 13:03:24 +01:00
|
|
|
#if defined(__is_sortix_libc)
|
2013-09-03 21:47:19 +02:00
|
|
|
typedef struct
|
|
|
|
{
|
|
|
|
__pthread_cond_t reader_condition;
|
|
|
|
__pthread_cond_t writer_condition;
|
|
|
|
__pthread_mutex_t request_mutex;
|
|
|
|
unsigned long num_readers;
|
|
|
|
unsigned long num_writers;
|
|
|
|
unsigned long pending_readers;
|
|
|
|
unsigned long pending_writers;
|
|
|
|
} __pthread_rwlock_t;
|
|
|
|
#else
|
|
|
|
typedef struct
|
|
|
|
{
|
|
|
|
__pthread_cond_t __pthread_reader_condition;
|
|
|
|
__pthread_cond_t __pthread_writer_condition;
|
|
|
|
__pthread_mutex_t __pthread_request_mutex;
|
|
|
|
unsigned long __pthread_num_readers;
|
|
|
|
unsigned long __pthread_num_writers;
|
|
|
|
unsigned long __pthread_pending_readers;
|
|
|
|
unsigned long __pthread_pending_writers;
|
|
|
|
} __pthread_rwlock_t;
|
|
|
|
#endif
|
2013-08-31 13:15:53 +02:00
|
|
|
|
2016-02-28 13:03:24 +01:00
|
|
|
#if defined(__is_sortix_libc)
|
2013-09-03 23:33:07 +02:00
|
|
|
typedef struct
|
|
|
|
{
|
2017-07-10 21:31:59 +02:00
|
|
|
char __structure_is_non_empty;
|
2013-09-03 23:33:07 +02:00
|
|
|
} __pthread_rwlockattr_t;
|
|
|
|
#else
|
|
|
|
typedef struct
|
|
|
|
{
|
2017-07-10 21:31:59 +02:00
|
|
|
char __structure_is_non_empty;
|
2013-09-03 23:33:07 +02:00
|
|
|
} __pthread_rwlockattr_t;
|
|
|
|
#endif
|
2013-08-31 13:15:53 +02:00
|
|
|
|
|
|
|
typedef int __pthread_spinlock_t;
|
|
|
|
|
2016-02-28 13:03:24 +01:00
|
|
|
#if defined(__is_sortix_libc)
|
2013-08-31 13:15:53 +02:00
|
|
|
typedef struct pthread* __pthread_t;
|
|
|
|
#else
|
|
|
|
typedef struct __pthread* __pthread_t;
|
|
|
|
#endif
|
|
|
|
|
2015-05-13 18:11:02 +02:00
|
|
|
#ifdef __cplusplus
|
|
|
|
} /* extern "C" */
|
|
|
|
#endif
|
2013-08-31 13:15:53 +02:00
|
|
|
|
|
|
|
#endif
|