My Project: dynamics.mod/NewtonDynamics/source/pthreads.2/implement.h File Reference

My Project

Classes | Macros | Typedefs | Enumerations | Functions | Variables
implement.h File Reference
`#include <windows.h>`
`#include <winsock.h>`
`#include <malloc.h>`
`#include <setjmp.h>`
`#include <limits.h>`
`#include "semaphore.h"`
`#include "sched.h"`
`#include <process.h>`

Go to the source code of this file.

## Classes

struct | ptw32_thread_t_
struct | pthread_attr_t_
struct | sem_t_
struct | pthread_mutex_t_
struct | ptw32_robust_node_t_
struct | pthread_mutexattr_t_
struct | pthread_spinlock_t_
struct | ptw32_mcs_node_t_
struct | pthread_barrier_t_
struct | pthread_barrierattr_t_
struct | pthread_key_t_
struct | ThreadParms
struct | pthread_cond_t_
struct | pthread_condattr_t_
struct | pthread_rwlock_t_
struct | pthread_rwlockattr_t_
struct | ThreadKeyAssoc

## Macros

#define | _WIN32_WINNT 0x0400
#define | ETIMEDOUT 10060 /* This is the value in winsock.h. */
#define | INLINE
#define | PTW32_INTERLOCKED_VOLATILE volatile
#define | PTW32_INTERLOCKED_LONG long
#define | PTW32_INTERLOCKED_SIZE size_t
#define | PTW32_INTERLOCKED_PVOID PVOID
#define | PTW32_INTERLOCKED_LONGPTR PTW32_INTERLOCKED_VOLATILE long*
#define | PTW32_INTERLOCKED_SIZEPTR PTW32_INTERLOCKED_VOLATILE size_t*
#define | PTW32_INTERLOCKED_PVOID_PTR PTW32_INTERLOCKED_VOLATILE PVOID*
#define | int64_t _int64
#define | PTW32_ATTR_VALID ((unsigned long) 0xC4C0FFEE)
#define | PTW32_OBJECT_AUTO_INIT ((void *)(size_t) -1)
#define | PTW32_OBJECT_INVALID NULL
#define | PTW32_SPIN_INVALID (0)
#define | PTW32_SPIN_UNLOCKED (1)
#define | PTW32_SPIN_LOCKED (2)
#define | PTW32_SPIN_USE_MUTEX (3)
#define | PTW32_RWLOCK_MAGIC 0xfacade2
#define | PTW32_EPS_EXIT (1)
#define | PTW32_EPS_CANCEL (2)
#define | PTW32_MAX(a, b) ((a)<(b)?(b):(a))
#define | PTW32_MIN(a, b) ((a)>(b)?(b):(a))
#define | PTW32_THREAD_REUSE_EMPTY ((ptw32_thread_t *)(size_t) 1)
#define | PTW32_INTERLOCKED_COMPARE_EXCHANGE_LONG InterlockedCompareExchange
#define | PTW32_INTERLOCKED_EXCHANGE_LONG InterlockedExchange
#define | PTW32_INTERLOCKED_EXCHANGE_ADD_LONG InterlockedExchangeAdd
#define | PTW32_INTERLOCKED_INCREMENT_LONG InterlockedIncrement
#define | PTW32_INTERLOCKED_DECREMENT_LONG InterlockedDecrement
#define | PTW32_INTERLOCKED_COMPARE_EXCHANGE_PTR InterlockedCompareExchangePointer
#define | PTW32_INTERLOCKED_EXCHANGE_PTR InterlockedExchangePointer
#define | PTW32_INTERLOCKED_COMPARE_EXCHANGE_SIZE PTW32_INTERLOCKED_COMPARE_EXCHANGE_LONG
#define | PTW32_INTERLOCKED_EXCHANGE_SIZE PTW32_INTERLOCKED_EXCHANGE_LONG
#define | PTW32_INTERLOCKED_EXCHANGE_ADD_SIZE PTW32_INTERLOCKED_EXCHANGE_ADD_LONG
#define | PTW32_INTERLOCKED_INCREMENT_SIZE PTW32_INTERLOCKED_INCREMENT_LONG
#define | PTW32_INTERLOCKED_DECREMENT_SIZE PTW32_INTERLOCKED_DECREMENT_LONG

## Typedefs

typedef struct ptw32_mcs_node_t_ | ptw32_mcs_local_node_t
typedef struct ptw32_mcs_node_t_ * | ptw32_mcs_lock_t
typedef struct ptw32_robust_node_t_ | ptw32_robust_node_t
typedef struct ptw32_thread_t_ | ptw32_thread_t
typedef enum ptw32_robust_state_t_ | ptw32_robust_state_t
typedef struct ThreadParms | ThreadParms
typedef struct ThreadKeyAssoc | ThreadKeyAssoc

## Enumerations

enum | PThreadState { PThreadStateInitial = 0, PThreadStateRunning, PThreadStateSuspended, PThreadStateCancelPending, PThreadStateCanceling, PThreadStateExiting, PThreadStateLast, PThreadStateReuse }
enum | ptw32_robust_state_t_ { PTW32_ROBUST_CONSISTENT, PTW32_ROBUST_INCONSISTENT, PTW32_ROBUST_NOTRECOVERABLE }

## Functions

int | ptw32_is_attr (const pthread_attr_t *attr)
int | ptw32_cond_check_need_init (pthread_cond_t *cond)
int | ptw32_mutex_check_need_init (pthread_mutex_t *mutex)
int | ptw32_rwlock_check_need_init (pthread_rwlock_t *rwlock)
int | ptw32_robust_mutex_inherit (pthread_mutex_t *mutex)
void | ptw32_robust_mutex_add (pthread_mutex_t *mutex, pthread_t self)
void | ptw32_robust_mutex_remove (pthread_mutex_t *mutex, ptw32_thread_t *otp)
DWORD | ptw32_RegisterCancelation (PAPCFUNC callback, HANDLE threadH, DWORD callback_arg)
int | ptw32_processInitialize (void)
void | ptw32_processTerminate (void)
void | ptw32_threadDestroy (pthread_t tid)
void | ptw32_pop_cleanup_all (int execute)
pthread_t | ptw32_new (void)
pthread_t | ptw32_threadReusePop (void)
void | ptw32_threadReusePush (pthread_t thread)
int | ptw32_getprocessors (int *count)
int | ptw32_setthreadpriority (pthread_t thread, int policy, int priority)
void | ptw32_rwlock_cancelwrwait (void *arg)
unsigned __stdcall | ptw32_threadStart (void *vthreadParms)
void | ptw32_callUserDestroyRoutines (pthread_t thread)
int | ptw32_tkAssocCreate (ptw32_thread_t *thread, pthread_key_t key)
void | ptw32_tkAssocDestroy (ThreadKeyAssoc *assoc)
int | ptw32_semwait (sem_t *sem)
DWORD | ptw32_relmillisecs (const struct timespec *abstime)
void | ptw32_mcs_lock_acquire (ptw32_mcs_lock_t *lock, ptw32_mcs_local_node_t *node)
int | ptw32_mcs_lock_try_acquire (ptw32_mcs_lock_t *lock, ptw32_mcs_local_node_t *node)
void | ptw32_mcs_lock_release (ptw32_mcs_local_node_t *node)
void | ptw32_mcs_node_transfer (ptw32_mcs_local_node_t *new_node, ptw32_mcs_local_node_t *old_node)
void | ptw32_throw (DWORD exception)

## Variables

DWORD(* | ptw32_register_cancelation )(PAPCFUNC, HANDLE, DWORD)
int | ptw32_processInitialized
ptw32_thread_t * | ptw32_threadReuseTop
ptw32_thread_t * | ptw32_threadReuseBottom
pthread_key_t | ptw32_selfThreadKey
pthread_key_t | ptw32_cleanupKey
pthread_cond_t | ptw32_cond_list_head
pthread_cond_t | ptw32_cond_list_tail
int | ptw32_mutex_default_kind
unsigned __int64 | ptw32_threadSeqNumber
int | ptw32_concurrency
int | ptw32_features
ptw32_mcs_lock_t | ptw32_thread_reuse_lock
ptw32_mcs_lock_t | ptw32_mutex_test_init_lock
ptw32_mcs_lock_t | ptw32_cond_list_lock
ptw32_mcs_lock_t | ptw32_cond_test_init_lock
ptw32_mcs_lock_t | ptw32_rwlock_test_init_lock
ptw32_mcs_lock_t | ptw32_spinlock_test_init_lock

## Macro Definition Documentation

## § _WIN32_WINNT

#define _WIN32_WINNT 0x0400

## § ETIMEDOUT

#define ETIMEDOUT 10060 /* This is the value in winsock.h. */

## § INLINE

#define INLINE

## § int64_t

#define int64_t _int64

## § PTW32_ATTR_VALID

#define PTW32_ATTR_VALID ((unsigned long) 0xC4C0FFEE)

## § PTW32_EPS_CANCEL

#define PTW32_EPS_CANCEL (2)

## § PTW32_EPS_EXIT

#define PTW32_EPS_EXIT (1)

## § PTW32_INTERLOCKED_COMPARE_EXCHANGE_LONG

#define PTW32_INTERLOCKED_COMPARE_EXCHANGE_LONG InterlockedCompareExchange

## § PTW32_INTERLOCKED_COMPARE_EXCHANGE_PTR

#define PTW32_INTERLOCKED_COMPARE_EXCHANGE_PTR InterlockedCompareExchangePointer

## § PTW32_INTERLOCKED_COMPARE_EXCHANGE_SIZE

#define PTW32_INTERLOCKED_COMPARE_EXCHANGE_SIZE PTW32_INTERLOCKED_COMPARE_EXCHANGE_LONG

## § PTW32_INTERLOCKED_DECREMENT_LONG

#define PTW32_INTERLOCKED_DECREMENT_LONG InterlockedDecrement

## § PTW32_INTERLOCKED_DECREMENT_SIZE

#define PTW32_INTERLOCKED_DECREMENT_SIZE PTW32_INTERLOCKED_DECREMENT_LONG

## § PTW32_INTERLOCKED_EXCHANGE_ADD_LONG

#define PTW32_INTERLOCKED_EXCHANGE_ADD_LONG InterlockedExchangeAdd

## § PTW32_INTERLOCKED_EXCHANGE_ADD_SIZE

#define PTW32_INTERLOCKED_EXCHANGE_ADD_SIZE PTW32_INTERLOCKED_EXCHANGE_ADD_LONG

## § PTW32_INTERLOCKED_EXCHANGE_LONG

#define PTW32_INTERLOCKED_EXCHANGE_LONG InterlockedExchange

## § PTW32_INTERLOCKED_EXCHANGE_PTR

#define PTW32_INTERLOCKED_EXCHANGE_PTR InterlockedExchangePointer

## § PTW32_INTERLOCKED_EXCHANGE_SIZE

#define PTW32_INTERLOCKED_EXCHANGE_SIZE PTW32_INTERLOCKED_EXCHANGE_LONG

## § PTW32_INTERLOCKED_INCREMENT_LONG

#define PTW32_INTERLOCKED_INCREMENT_LONG InterlockedIncrement

## § PTW32_INTERLOCKED_INCREMENT_SIZE

#define PTW32_INTERLOCKED_INCREMENT_SIZE PTW32_INTERLOCKED_INCREMENT_LONG

## § PTW32_INTERLOCKED_LONG

#define PTW32_INTERLOCKED_LONG long

## § PTW32_INTERLOCKED_LONGPTR

#define PTW32_INTERLOCKED_LONGPTR PTW32_INTERLOCKED_VOLATILE long*

## § PTW32_INTERLOCKED_PVOID

#define PTW32_INTERLOCKED_PVOID PVOID

## § PTW32_INTERLOCKED_PVOID_PTR

#define PTW32_INTERLOCKED_PVOID_PTR PTW32_INTERLOCKED_VOLATILE PVOID*

## § PTW32_INTERLOCKED_SIZE

#define PTW32_INTERLOCKED_SIZE size_t

## § PTW32_INTERLOCKED_SIZEPTR

#define PTW32_INTERLOCKED_SIZEPTR PTW32_INTERLOCKED_VOLATILE size_t*

## § PTW32_INTERLOCKED_VOLATILE

#define PTW32_INTERLOCKED_VOLATILE volatile

## § PTW32_MAX

#define PTW32_MAX | ( |  | a,
|  |  | b
| ) |  | ((a)<(b)?(b):(a))

## § PTW32_MIN

#define PTW32_MIN | ( |  | a,
|  |  | b
| ) |  | ((a)>(b)?(b):(a))

## § PTW32_OBJECT_AUTO_INIT

#define PTW32_OBJECT_AUTO_INIT ((void *)(size_t) -1)

## § PTW32_OBJECT_INVALID

#define PTW32_OBJECT_INVALID NULL

## § PTW32_RWLOCK_MAGIC

#define PTW32_RWLOCK_MAGIC 0xfacade2

## § PTW32_SPIN_INVALID

#define PTW32_SPIN_INVALID (0)

## § PTW32_SPIN_LOCKED

#define PTW32_SPIN_LOCKED (2)

## § PTW32_SPIN_UNLOCKED

#define PTW32_SPIN_UNLOCKED (1)

## § PTW32_SPIN_USE_MUTEX

#define PTW32_SPIN_USE_MUTEX (3)

## § PTW32_THREAD_REUSE_EMPTY

#define PTW32_THREAD_REUSE_EMPTY ((ptw32_thread_t *)(size_t) 1)

## Typedef Documentation

## § ptw32_mcs_local_node_t

typedef struct ptw32_mcs_node_t_ ptw32_mcs_local_node_t

## § ptw32_mcs_lock_t

typedef struct ptw32_mcs_node_t_* ptw32_mcs_lock_t

## § ptw32_robust_node_t

typedef struct ptw32_robust_node_t_ ptw32_robust_node_t

## § ptw32_robust_state_t

typedef enum ptw32_robust_state_t_ ptw32_robust_state_t

## § ptw32_thread_t

typedef struct ptw32_thread_t_ ptw32_thread_t

## § ThreadKeyAssoc

typedef struct ThreadKeyAssoc ThreadKeyAssoc

## § ThreadParms

typedef struct ThreadParms ThreadParms

## Enumeration Type Documentation

## § PThreadState

enum PThreadState

Enumerator
PThreadStateInitial |
PThreadStateRunning |
PThreadStateSuspended |
PThreadStateCancelPending |
PThreadStateCanceling |
PThreadStateExiting |
PThreadStateLast |
PThreadStateReuse |

## § ptw32_robust_state_t_

enum ptw32_robust_state_t_

Enumerator
PTW32_ROBUST_CONSISTENT |
PTW32_ROBUST_INCONSISTENT |
PTW32_ROBUST_NOTRECOVERABLE |

## Function Documentation

## § ptw32_callUserDestroyRoutines()

void ptw32_callUserDestroyRoutines | ( | pthread_t | thread | ) |

## § ptw32_cond_check_need_init()

int ptw32_cond_check_need_init | ( | pthread_cond_t * | cond | ) |

## § ptw32_getprocessors()

int ptw32_getprocessors | ( | int * | count | ) |

## § ptw32_is_attr()

int ptw32_is_attr | ( | const pthread_attr_t * | attr | ) |

## § ptw32_mcs_lock_acquire()

void ptw32_mcs_lock_acquire | ( | ptw32_mcs_lock_t * | lock,
|  | ptw32_mcs_local_node_t * | node
| ) |  |

## § ptw32_mcs_lock_release()

void ptw32_mcs_lock_release | ( | ptw32_mcs_local_node_t * | node | ) |

## § ptw32_mcs_lock_try_acquire()

int ptw32_mcs_lock_try_acquire | ( | ptw32_mcs_lock_t * | lock,
|  | ptw32_mcs_local_node_t * | node
| ) |  |

## § ptw32_mcs_node_transfer()

void ptw32_mcs_node_transfer | ( | ptw32_mcs_local_node_t * | new_node,
|  | ptw32_mcs_local_node_t * | old_node
| ) |  |

## § ptw32_mutex_check_need_init()

int ptw32_mutex_check_need_init | ( | pthread_mutex_t * | mutex | ) |

## § ptw32_new()

pthread_t ptw32_new | ( | void |  | ) |

## § ptw32_pop_cleanup_all()

void ptw32_pop_cleanup_all | ( | int | execute | ) |

## § ptw32_processInitialize()

int ptw32_processInitialize | ( | void |  | ) |

## § ptw32_processTerminate()

void ptw32_processTerminate | ( | void |  | ) |

## § ptw32_RegisterCancelation()

DWORD ptw32_RegisterCancelation | ( | PAPCFUNC | callback,
|  | HANDLE | threadH,
|  | DWORD | callback_arg
| ) |  |

## § ptw32_relmillisecs()

DWORD ptw32_relmillisecs | ( | const struct timespec * | abstime | ) |

## § ptw32_robust_mutex_add()

void ptw32_robust_mutex_add | ( | pthread_mutex_t * | mutex,
|  | pthread_t | self
| ) |  |

## § ptw32_robust_mutex_inherit()

int ptw32_robust_mutex_inherit | ( | pthread_mutex_t * | mutex | ) |

## § ptw32_robust_mutex_remove()

void ptw32_robust_mutex_remove | ( | pthread_mutex_t * | mutex,
|  | ptw32_thread_t * | otp
| ) |  |

## § ptw32_rwlock_cancelwrwait()

void ptw32_rwlock_cancelwrwait | ( | void * | arg | ) |

## § ptw32_rwlock_check_need_init()

int ptw32_rwlock_check_need_init | ( | pthread_rwlock_t * | rwlock | ) |

## § ptw32_semwait()

int ptw32_semwait | ( | sem_t * | sem | ) |

## § ptw32_setthreadpriority()

int ptw32_setthreadpriority | ( | pthread_t | thread,
|  | int | policy,
|  | int | priority
| ) |  |

## § ptw32_threadDestroy()

void ptw32_threadDestroy | ( | pthread_t | tid | ) |

## § ptw32_threadReusePop()

pthread_t ptw32_threadReusePop | ( | void |  | ) |

## § ptw32_threadReusePush()

void ptw32_threadReusePush | ( | pthread_t | thread | ) |

## § ptw32_threadStart()

unsigned __stdcall ptw32_threadStart | ( | void * | vthreadParms | ) |

## § ptw32_throw()

void ptw32_throw | ( | DWORD | exception | ) |

## § ptw32_tkAssocCreate()

int ptw32_tkAssocCreate | ( | ptw32_thread_t * | thread,
|  | pthread_key_t | key
| ) |  |

## § ptw32_tkAssocDestroy()

void ptw32_tkAssocDestroy | ( | ThreadKeyAssoc * | assoc | ) |

## Variable Documentation

## § ptw32_cleanupKey

pthread_key_t ptw32_cleanupKey

## § ptw32_concurrency

int ptw32_concurrency

## § ptw32_cond_list_head

pthread_cond_t ptw32_cond_list_head

## § ptw32_cond_list_lock

ptw32_mcs_lock_t ptw32_cond_list_lock

## § ptw32_cond_list_tail

pthread_cond_t ptw32_cond_list_tail

## § ptw32_cond_test_init_lock

ptw32_mcs_lock_t ptw32_cond_test_init_lock

## § ptw32_features

int ptw32_features

## § ptw32_mutex_default_kind

int ptw32_mutex_default_kind

## § ptw32_mutex_test_init_lock

ptw32_mcs_lock_t ptw32_mutex_test_init_lock

## § ptw32_processInitialized

int ptw32_processInitialized

## § ptw32_register_cancelation

DWORD(* ptw32_register_cancelation) (PAPCFUNC, HANDLE, DWORD)

## § ptw32_rwlock_test_init_lock

ptw32_mcs_lock_t ptw32_rwlock_test_init_lock

## § ptw32_selfThreadKey

pthread_key_t ptw32_selfThreadKey

## § ptw32_spinlock_test_init_lock

ptw32_mcs_lock_t ptw32_spinlock_test_init_lock

## § ptw32_thread_reuse_lock

ptw32_mcs_lock_t ptw32_thread_reuse_lock

## § ptw32_threadReuseBottom

ptw32_thread_t* ptw32_threadReuseBottom

## § ptw32_threadReuseTop

ptw32_thread_t* ptw32_threadReuseTop

## § ptw32_threadSeqNumber

unsigned __int64 ptw32_threadSeqNumber