hythread.h File Reference


Classes

struct  HyThreadMonitorTracing
struct  HyThread_public
 Native thread control structure's public fields. More...

Defines

#define HYTHREAD_H
#define hy_inline   static __forceinline
#define HYTHREAD_PROC   VMCALL
#define HYTHREAD_PRIORITY_MIN   0
#define HYTHREAD_PRIORITY_USER_MIN   1
#define HYTHREAD_PRIORITY_NORMAL   5
#define HYTHREAD_PRIORITY_USER_MAX   10
#define HYTHREAD_PRIORITY_MAX   11
#define HYTHREAD_LOCKING_DEFAULT   0
#define HYTHREAD_LOCKING_NO_DATA   (-1)
#define HYTHREAD_FLAG_BLOCKED   1
#define HYTHREAD_ALREADY_INITIALIZED   4
#define HYTHREAD_TIMED_OUT   3
#define HYTHREAD_FLAG_STARTED   0x800
#define HYTHREAD_FLAG_JLM_HAS_BEEN_ENABLED   0x20000
#define HYTHREAD_ILLEGAL_MONITOR_STATE   1
#define HYTHREAD_FLAG_PRIORITY_INTERRUPTED   0x100
#define HYTHREAD_FLAG_JLMHST_ENABLED   0x10000
#define HYTHREAD_FLAG_JLM_ENABLED   0x4000
#define HYTHREAD_FLAG_INTERRUPTED   4
#define HYTHREAD_INVALID_ARGUMENT   7
#define HYTHREAD_FLAG_DETACHED   0x80
#define HYTHREAD_PRIORITY_INTERRUPTED   5
#define HYTHREAD_FLAG_CANCELED   0x400
#define HYTHREAD_FLAG_NOTIFIED   16
#define HYTHREAD_FLAG_ATTACHED   0x200
#define HYTHREAD_WOULD_BLOCK   8
#define HYTHREAD_FLAG_DEAD   32
#define HYTHREAD_FLAG_WAITING   2
#define HYTHREAD_FLAG_PARKED   0x40000
#define HYTHREAD_FLAG_UNPARKED   0x80000
#define HYTHREAD_FLAG_INTERRUPTABLE   0x2000
#define HYTHREAD_FLAG_TIMER_SET   0x100000
#define HYTHREAD_FLAG_JLM_ENABLED_ALL   0x1C000
#define HYTHREAD_FLAG_JLMTS_ENABLED   0x8000
#define HYTHREAD_INTERRUPTED   2
#define HYTHREAD_FLAG_BLOCKED_AFTER_WAIT   0x1000
#define HYTHREAD_ALREADY_ATTACHED   6
#define HYTHREAD_FLAG_SUSPENDED   8
#define HYTHREAD_FLAG_SLEEPING   64
#define HYTHREAD_MONITOR_INFLATED   0x10000
#define HYTHREAD_MONITOR_INTERRUPTABLE   0x20000
#define HYTHREAD_MONITOR_PRIORITY_INTERRUPTABLE   0x40000
#define HYTHREAD_MONITOR_SYSTEM   0
#define HYTHREAD_MONITOR_OBJECT   0x60000
#define HYTHREAD_MONITOR_MUTEX_UNINITIALIZED   0x80000
#define HYTHREAD_MONITOR_SUPPRESS_CONTENDED_EXIT   0x100000
#define HYTHREAD_MONITOR_MUTEX_IN_USE   0x200000
#define HYTHREAD_MONITOR_SPINLOCK_UNOWNED   0
#define HYTHREAD_MONITOR_SPINLOCK_OWNED   1
#define HYTHREAD_MONITOR_SPINLOCK_EXCEEDED   2
#define HYTHREAD_LIB_FLAG_JLMHST_ENABLED   0x10000
#define HYTHREAD_LIB_FLAG_JLM_ENABLED   0x4000
#define HYTHREAD_LIB_FLAG_JLM_ENABLED_ALL   0x1C000
#define HYTHREAD_LIB_FLAG_JLM_HAS_BEEN_ENABLED   0x20000
#define HYTHREAD_LIB_FLAG_JLMTS_ENABLED   0x8000
#define HYSIZEOF_HyThreadMonitorTracing   24
#define _HYVMTHREADHELPERS_
#define _HYVMTHREADSPINLOCKS_
#define hythread_global_monitor()   (*(hythread_monitor_t*)hythread_global("global_monitor"))
#define hythread_monitor_init(pMon, flags)   hythread_monitor_init_with_name(pMon,flags, #pMon)
#define hythread_monitor_set_name(pMon, pName)
#define ASM_MONITOR_HELPER
 HYTHREAD_FAST_TLS Enables platform-specific TLS access optimization, such as:
#define HYTHREAD_FAST_TLS_ATTRIBUTE

Typedefs

typedef UDATA hythread_tls_key_t
typedef IDATA(VMCALL *) hythread_entrypoint_t (void *)
typedef void(VMCALL *) hythread_tls_finalizer_t (void *)
typedef HyThreadhythread_t
typedef HyThreadGroup * hythread_group_t
typedef HyThreadMonitor * hythread_monitor_t
typedef HySemaphore * hysem_t
typedef RWMutex * hythread_rwmutex_t

Functions

HY_CFUNC void VMCALL hythread_detach PROTOTYPE ((hythread_t thread))
HY_CFUNC UDATA VMCALL hythread_lib_set_flags PROTOTYPE ((UDATA flags))
HY_CFUNC IDATA VMCALL hythread_tls_alloc PROTOTYPE ((hythread_tls_key_t *handle))
HY_CFUNC IDATA VMCALL hythread_sleep_interruptable PROTOTYPE ((I_64 millis, IDATA nanos))
HY_CFUNC IDATA VMCALL hythread_monitor_enter_using_threadId PROTOTYPE ((hythread_monitor_t monitor, hythread_t threadId))
HY_CFUNC UDATA VMCALL hythread_clear_interrupted PROTOTYPE ((void))
HY_CFUNC void VMCALL hythread_lib_unlock PROTOTYPE ((hythread_t self))
HY_CFUNC IDATA VMCALL hythread_monitor_enter PROTOTYPE ((hythread_monitor_t monitor))
HY_CFUNC IDATA VMCALL hythread_attach PROTOTYPE ((hythread_t *handle))
HY_CFUNC HyThreadMonitorTracing
*VMCALL hythread_jlm_get_gc_lock_tracing 
PROTOTYPE (())
HY_CFUNC IDATA VMCALL hysem_post PROTOTYPE ((hysem_t s))
HY_CFUNC void VMCALL hythread_monitor_lock PROTOTYPE ((hythread_t self, hythread_monitor_t monitor))
HY_CFUNC IDATA VMCALL hythread_monitor_init_with_name PROTOTYPE ((hythread_monitor_t *handle, UDATA flags, char *name))
HY_CFUNC IDATA VMCALL hythread_tls_free PROTOTYPE ((hythread_tls_key_t key))
HY_CFUNC IDATA VMCALL hythread_tls_set PROTOTYPE ((hythread_t thread, hythread_tls_key_t key, void *value))
HY_CFUNC IDATA VMCALL hythread_create PROTOTYPE ((hythread_t *handle, UDATA stacksize, UDATA priority, UDATA suspend, hythread_entrypoint_t entrypoint, void *entryarg))
HY_CFUNC IDATA VMCALL hysem_init PROTOTYPE ((hysem_t *sp, I_32 initValue))
HY_CFUNC IDATA VMCALL hythread_monitor_init_policy PROTOTYPE ((hythread_monitor_t *handle, UDATA flags, IDATA policy, IDATA policyData))
HY_CFUNC IDATA VMCALL hythread_monitor_wait_interruptable PROTOTYPE ((hythread_monitor_t monitor, I_64 millis, IDATA nanos))
HY_CFUNC IDATA VMCALL hythread_set_priority PROTOTYPE ((hythread_t thread, UDATA priority))
HY_CFUNC IDATA VMCALL hythread_monitor_init PROTOTYPE ((hythread_monitor_t *handle, UDATA flags))
HY_CFUNC IDATA VMCALL hythread_sleep PROTOTYPE ((I_64 millis))
HY_CFUNC UDATA *VMCALL hythread_global PROTOTYPE ((char *name))
HY_CFUNC IDATA VMCALL hythread_tls_alloc_with_finalizer PROTOTYPE ((hythread_tls_key_t *handle, hythread_tls_finalizer_t finalizer))
HY_CFUNC void VMCALL hythread_enable_stack_usage PROTOTYPE ((UDATA enable))
HY_CFUNC IDATA VMCALL hythread_get_os_priority PROTOTYPE ((hythread_t thread, IDATA *policy, IDATA *priority))
HY_CFUNC UDATA VMCALL hythread_get_flags PROTOTYPE ((hythread_t thread, hythread_monitor_t *blocker))
HY_CFUNC IDATA VMCALL hythread_rwmutex_enter_read PROTOTYPE ((hythread_rwmutex_t mutex))
HY_CFUNC IDATA VMCALL hythread_rwmutex_init PROTOTYPE ((hythread_rwmutex_t *handle, UDATA flags, const char *name))
HY_CFUNC UDATA VMCALL current_stack_depth ()
HY_CFUNC void VMCALL hythread_monitor_unpin (hythread_monitor_t monitor, hythread_t osThread)
HY_CFUNC void VMCALL hythread_monitor_pin (hythread_monitor_t monitor, hythread_t osThread)
HY_CFUNC IDATA VMCALL hythread_spinlock_acquire (hythread_t self, hythread_monitor_t monitor)
HY_CFUNC UDATA VMCALL hythread_spinlock_swapState (hythread_monitor_t monitor, UDATA newState)
 __declspec (thread) hythread_t tm_self_tls
static __forceinline hythread_t
VMCALL 
hythread_self ()
static __forceinline void
*VMCALL 
hythread_tls_get (hythread_t thread, hythread_tls_key_t key)
 Returns a thread's TLS value.


Define Documentation

#define HYTHREAD_H

#define hy_inline   static __forceinline

#define HYTHREAD_PROC   VMCALL

#define HYTHREAD_PRIORITY_MIN   0

#define HYTHREAD_PRIORITY_USER_MIN   1

#define HYTHREAD_PRIORITY_NORMAL   5

#define HYTHREAD_PRIORITY_USER_MAX   10

#define HYTHREAD_PRIORITY_MAX   11

#define HYTHREAD_LOCKING_DEFAULT   0

#define HYTHREAD_LOCKING_NO_DATA   (-1)

#define HYTHREAD_FLAG_BLOCKED   1

#define HYTHREAD_ALREADY_INITIALIZED   4

#define HYTHREAD_TIMED_OUT   3

#define HYTHREAD_FLAG_STARTED   0x800

#define HYTHREAD_FLAG_JLM_HAS_BEEN_ENABLED   0x20000

#define HYTHREAD_ILLEGAL_MONITOR_STATE   1

#define HYTHREAD_FLAG_PRIORITY_INTERRUPTED   0x100

#define HYTHREAD_FLAG_JLMHST_ENABLED   0x10000

#define HYTHREAD_FLAG_JLM_ENABLED   0x4000

#define HYTHREAD_FLAG_INTERRUPTED   4

#define HYTHREAD_INVALID_ARGUMENT   7

#define HYTHREAD_FLAG_DETACHED   0x80

#define HYTHREAD_PRIORITY_INTERRUPTED   5

#define HYTHREAD_FLAG_CANCELED   0x400

#define HYTHREAD_FLAG_NOTIFIED   16

#define HYTHREAD_FLAG_ATTACHED   0x200

#define HYTHREAD_WOULD_BLOCK   8

#define HYTHREAD_FLAG_DEAD   32

#define HYTHREAD_FLAG_WAITING   2

#define HYTHREAD_FLAG_PARKED   0x40000

#define HYTHREAD_FLAG_UNPARKED   0x80000

#define HYTHREAD_FLAG_INTERRUPTABLE   0x2000

#define HYTHREAD_FLAG_TIMER_SET   0x100000

#define HYTHREAD_FLAG_JLM_ENABLED_ALL   0x1C000

#define HYTHREAD_FLAG_JLMTS_ENABLED   0x8000

#define HYTHREAD_INTERRUPTED   2

#define HYTHREAD_FLAG_BLOCKED_AFTER_WAIT   0x1000

#define HYTHREAD_ALREADY_ATTACHED   6

#define HYTHREAD_FLAG_SUSPENDED   8

#define HYTHREAD_FLAG_SLEEPING   64

#define HYTHREAD_MONITOR_INFLATED   0x10000

#define HYTHREAD_MONITOR_INTERRUPTABLE   0x20000

#define HYTHREAD_MONITOR_PRIORITY_INTERRUPTABLE   0x40000

#define HYTHREAD_MONITOR_SYSTEM   0

#define HYTHREAD_MONITOR_OBJECT   0x60000

#define HYTHREAD_MONITOR_MUTEX_UNINITIALIZED   0x80000

#define HYTHREAD_MONITOR_SUPPRESS_CONTENDED_EXIT   0x100000

#define HYTHREAD_MONITOR_MUTEX_IN_USE   0x200000

#define HYTHREAD_MONITOR_SPINLOCK_UNOWNED   0

#define HYTHREAD_MONITOR_SPINLOCK_OWNED   1

#define HYTHREAD_MONITOR_SPINLOCK_EXCEEDED   2

#define HYTHREAD_LIB_FLAG_JLMHST_ENABLED   0x10000

#define HYTHREAD_LIB_FLAG_JLM_ENABLED   0x4000

#define HYTHREAD_LIB_FLAG_JLM_ENABLED_ALL   0x1C000

#define HYTHREAD_LIB_FLAG_JLM_HAS_BEEN_ENABLED   0x20000

#define HYTHREAD_LIB_FLAG_JLMTS_ENABLED   0x8000

#define HYSIZEOF_HyThreadMonitorTracing   24

#define _HYVMTHREADHELPERS_

#define _HYVMTHREADSPINLOCKS_

 
#define hythread_global_monitor (  )     (*(hythread_monitor_t*)hythread_global("global_monitor"))

#define hythread_monitor_init ( pMon,
flags   )     hythread_monitor_init_with_name(pMon,flags, #pMon)

#define hythread_monitor_set_name ( pMon,
pName   ) 

#define ASM_MONITOR_HELPER

HYTHREAD_FAST_TLS Enables platform-specific TLS access optimization, such as:

APR_TLS_USE

When APR_TLS_USE is declared DRLVM uses APR functions for getting current thread. (currently it's used only on Windows 64-bit)

If none of these defined, current thread id is kept in the tm_self_tls variable which is declared as __thread, thread local variable for gcc (*note Thread-Local:: in gcc.info), in thread_native_basic.c. This way it works on Linux.

#define HYTHREAD_FAST_TLS_ATTRIBUTE


Typedef Documentation

typedef UDATA hythread_tls_key_t

typedef IDATA( VMCALL *) hythread_entrypoint_t(void *)

typedef void( VMCALL *) hythread_tls_finalizer_t(void *)

typedef struct HyThread* hythread_t

typedef struct HyThreadGroup* hythread_group_t

typedef struct HyThreadMonitor* hythread_monitor_t

typedef struct HySemaphore* hysem_t

typedef struct RWMutex* hythread_rwmutex_t


Function Documentation

HY_CFUNC UDATA VMCALL hythread_get_priority PROTOTYPE ( (hythread_t thread  ) 

HY_CFUNC UDATA VMCALL hythread_lib_clear_flags PROTOTYPE ( (UDATA flags)   ) 

HY_CFUNC IDATA VMCALL hythread_tls_alloc PROTOTYPE ( (hythread_tls_key_t *handle)   ) 

HY_CFUNC IDATA VMCALL hythread_park PROTOTYPE ( (I_64 millis, IDATA nanos)   ) 

HY_CFUNC IDATA VMCALL hythread_monitor_exit_using_threadId PROTOTYPE ( (hythread_monitor_t monitor, hythread_t threadId)   ) 

HY_CFUNC void VMCALL hythread_suspend PROTOTYPE ( (void)   ) 

HY_CFUNC void VMCALL hythread_lib_lock PROTOTYPE ( (hythread_t self)   ) 

HY_CFUNC hythread_monitor_t VMCALL hythread_monitor_walk PROTOTYPE ( (hythread_monitor_t monitor)   ) 

HY_CFUNC IDATA VMCALL hythread_attach PROTOTYPE ( (hythread_t *handle)   ) 

HY_CFUNC UDATA VMCALL hythread_lib_get_flags PROTOTYPE ( ()   ) 

HY_CFUNC IDATA VMCALL hysem_destroy PROTOTYPE ( (hysem_t s)   ) 

HY_CFUNC void VMCALL hythread_monitor_unlock PROTOTYPE ( (hythread_t self, hythread_monitor_t monitor)   ) 

HY_CFUNC IDATA VMCALL hythread_monitor_init_with_name PROTOTYPE ( (hythread_monitor_t *handle, UDATA flags, char *name  ) 

HY_CFUNC IDATA VMCALL hythread_tls_free PROTOTYPE ( (hythread_tls_key_t key)   ) 

HY_CFUNC IDATA VMCALL hythread_tls_set PROTOTYPE ( (hythread_t thread, hythread_tls_key_t key, void *value  ) 

HY_CFUNC IDATA VMCALL hythread_create PROTOTYPE ( (hythread_t *handle, UDATA stacksize, UDATA priority, UDATA suspend, hythread_entrypoint_t entrypoint, void *entryarg)   ) 

HY_CFUNC IDATA VMCALL hysem_init PROTOTYPE ( (hysem_t *sp, I_32 initValue)   ) 

HY_CFUNC IDATA VMCALL hythread_monitor_init_policy PROTOTYPE ( (hythread_monitor_t *handle, UDATA flags, IDATA policy, IDATA policyData)   ) 

HY_CFUNC IDATA VMCALL hythread_monitor_wait_timed PROTOTYPE ( (hythread_monitor_t monitor, I_64 millis, IDATA nanos)   ) 

HY_CFUNC IDATA VMCALL hythread_set_priority PROTOTYPE ( (hythread_t thread, UDATA priority)   ) 

HY_CFUNC IDATA VMCALL hythread_monitor_init PROTOTYPE ( (hythread_monitor_t *handle, UDATA flags)   ) 

HY_CFUNC IDATA VMCALL hythread_sleep PROTOTYPE ( (I_64 millis)   ) 

HY_CFUNC UDATA* VMCALL hythread_global PROTOTYPE ( (char *name  ) 

HY_CFUNC IDATA VMCALL hythread_tls_alloc_with_finalizer PROTOTYPE ( (hythread_tls_key_t *handle, hythread_tls_finalizer_t finalizer)   ) 

HY_CFUNC void VMCALL hythread_enable_stack_usage PROTOTYPE ( (UDATA enable)   ) 

HY_CFUNC IDATA VMCALL hythread_get_os_priority PROTOTYPE ( (hythread_t thread, IDATA *policy, IDATA *priority)   ) 

HY_CFUNC UDATA VMCALL hythread_get_flags PROTOTYPE ( (hythread_t thread, hythread_monitor_t *blocker)   ) 

HY_CFUNC IDATA VMCALL hythread_rwmutex_enter_write PROTOTYPE ( (hythread_rwmutex_t mutex)   ) 

HY_CFUNC IDATA VMCALL hythread_rwmutex_init PROTOTYPE ( (hythread_rwmutex_t *handle, UDATA flags, const char *name  ) 

HY_CFUNC UDATA VMCALL current_stack_depth (  ) 

HY_CFUNC void VMCALL hythread_monitor_unpin ( hythread_monitor_t  monitor,
hythread_t  osThread 
)

HY_CFUNC void VMCALL hythread_monitor_pin ( hythread_monitor_t  monitor,
hythread_t  osThread 
)

HY_CFUNC IDATA VMCALL hythread_spinlock_acquire ( hythread_t  self,
hythread_monitor_t  monitor 
)

HY_CFUNC UDATA VMCALL hythread_spinlock_swapState ( hythread_monitor_t  monitor,
UDATA  newState 
)

__declspec ( thread   ) 

static __forceinline hythread_t VMCALL hythread_self (  )  [static]

static __forceinline void* VMCALL hythread_tls_get ( hythread_t  thread,
hythread_tls_key_t  key 
) [static]

Returns a thread's TLS value.


Genereated on Tue Mar 11 19:25:22 2008 by Doxygen.

(c) Copyright 2005, 2008 The Apache Software Foundation or its licensors, as applicable.