modules/portlib/src/main/native/thread/shared/hythread.c File Reference


Detailed Description

Threading and synchronization support.

#include "threaddef.h"
#include <stdlib.h>

Functions

void VMCALL hythread_shutdown (void)
 Shut down the Hy threading library associated with the current thread.
void VMCALL hythread_init (hythread_library_t lib)
 Initialize a Hy threading library.
hythread_t VMCALL hythread_self (void)
 Return the hythread_t for the current thread.
IDATA VMCALL hythread_create (hythread_t *handle, UDATA stacksize, UDATA priority, UDATA suspend, hythread_entrypoint_t entrypoint, void *entryarg)
 Create a new OS thread.
IDATA VMCALL hythread_attach (hythread_t *handle)
 Attach an OS thread to the threading library.
void VMCALL hythread_suspend (void)
 Suspend the current thread.
void VMCALL hythread_resume (hythread_t thread)
 Resume a thread.
void VMCALL hythread_yield (void)
 Yield the processor.
IDATA VMCALL hythread_monitor_destroy (hythread_monitor_t monitor)
 Destroy a monitor.
IDATA VMCALL hythread_monitor_enter (hythread_monitor_t monitor)
 Enter a monitor.
IDATA VMCALL hythread_monitor_exit (hythread_monitor_t monitor)
 Exit a monitor.
IDATA VMCALL hythread_monitor_wait (hythread_monitor_t monitor)
 Wait on a monitor until notified.
IDATA VMCALL hythread_monitor_notify (hythread_monitor_t monitor)
 Notify a single thread waiting on a monitor.
IDATA VMCALL hythread_monitor_notify_all (hythread_monitor_t monitor)
 Notify all threads waiting on a monitor.
IDATA VMCALL hythread_tls_alloc (hythread_tls_key_t *handle)
 Allocate a thread local storage (TLS) key.
IDATA VMCALL hythread_tls_free (hythread_tls_key_t key)
 Release a TLS key.
IDATA VMCALL hythread_tls_set (hythread_t thread, hythread_tls_key_t key, void *value)
 Set a thread's TLS value.
IDATA VMCALL hythread_set_priority (hythread_t thread, UDATA priority)
 Set a thread's execution priority.
void VMCALL hythread_interrupt (hythread_t thread)
 Interrupt a thread.
UDATA VMCALL hythread_interrupted (hythread_t thread)
 Return the value of a thread's interrupted flag.
UDATA VMCALL hythread_clear_interrupted (void)
 Clear the interrupted flag of the current thread and return its previous value.
IDATA VMCALL hythread_sleep_interruptable (I_64 millis, IDATA nanos)
 Suspend the current thread from executing for at least the specified time.
IDATA VMCALL hythread_sleep (I_64 millis)
 Suspend the current thread from executing for at least the specified time.
void VMCALL hythread_cancel (hythread_t thread)
 Terminate a running thread.
void VMCALL hythread_detach (hythread_t thread)
 Detaches the current thread from the threading library.
void VMCALL NORETURN hythread_exit (hythread_monitor_t monitor)
 Exit the current thread.
void VMCALL hythread_priority_interrupt (hythread_t thread)
 Priority interrupt a thread.
UDATA VMCALL hythread_priority_interrupted (hythread_t thread)
 Return the value of a thread's priority interrupted flag.
UDATA VMCALL hythread_clear_priority_interrupted (void)
 Clear the priority interrupted flag of the current thread and return its previous value.
IDATA VMCALL hythread_monitor_try_enter (hythread_monitor_t monitor)
 Attempt to enter a monitor without blocking.
IDATA VMCALL hythread_monitor_wait_timed (hythread_monitor_t monitor, I_64 millis, IDATA nanos)
 Wait on a monitor until notified or timed out.
UDATA *VMCALL hythread_global (char *name)
 Fetch or create a 'named global'.
IDATA VMCALL hythread_monitor_wait_interruptable (hythread_monitor_t monitor, I_64 millis, IDATA nanos)
 Wait on a monitor until notified, interrupted (priority or normal), or timed out.
UDATA VMCALL hythread_monitor_num_waiting (hythread_monitor_t monitor)
 Returns how many threads are currently waiting on a monitor.
IDATA VMCALL hythread_monitor_exit_using_threadId (hythread_monitor_t monitor, hythread_t threadId)
 Exit a monitor.
IDATA VMCALL hythread_monitor_enter_using_threadId (hythread_monitor_t monitor, hythread_t threadId)
 Enter a monitor.
IDATA VMCALL hythread_monitor_try_enter_using_threadId (hythread_monitor_t monitor, hythread_t threadId)
 Attempt to enter a monitor without blocking.
UDATA VMCALL hythread_lib_get_flags ()
 Get threading library global flags.
UDATA VMCALL hythread_lib_set_flags (UDATA flags)
 Set threading library global flags.
UDATA VMCALL hythread_lib_clear_flags (UDATA flags)
 Clear specified threading library global flags.
IDATA VMCALL hythread_monitor_init_with_name (hythread_monitor_t *handle, UDATA flags, char *name)
 Acquire and initialize a new monitor from the threading library.
void VMCALL hythread_lib_lock (hythread_t self)
 Acquire the threading library's global lock.
void VMCALL hythread_lib_unlock (hythread_t self)
 Release the threading library's global lock.
IDATA VMCALL hythread_park (I_64 millis, IDATA nanos)
 'Park' the current thread.
void VMCALL hythread_unpark (hythread_t thread)
 'Unpark' the specified thread.
IDATA VMCALL hythread_tls_alloc_with_finalizer (hythread_tls_key_t *handle, hythread_tls_finalizer_t finalizer)
 Allocate a thread local storage (TLS) key.
UDATA VMCALL hythread_current_stack_free (void)
 Return the remaining useable bytes of the current thread's OS stack.


Function Documentation

IDATA VMCALL hythread_attach ( hythread_t *  handle  ) 

Attach an OS thread to the threading library.

Create a new hythread_t to represent the existing OS thread. Attaching a thread is required when a thread was created outside of the Hy threading library wants to use any of the Hy threading library functionality.

If the OS thread is already attached, handle is set to point to the existing hythread_t.

Parameters:
[out] handle pointer to a hythread_t to be set (will be ignored if null)
Returns:
0 on success or negative value on failure
See also:
hythread_detach

void VMCALL hythread_cancel ( hythread_t  thread  ) 

Terminate a running thread.

Note:
This should only be used as a last resort. The system may be in an unpredictable state once a thread is cancelled. In addition, the thread may not even stop running if it refuses to cancel.
Parameters:
[in] thread a thread to be terminated
Returns:
none

UDATA VMCALL hythread_clear_interrupted ( void   ) 

Clear the interrupted flag of the current thread and return its previous value.

Returns:
previous value of interrupted flag: non-zero if the thread had been interrupted.

UDATA VMCALL hythread_clear_priority_interrupted ( void   ) 

Clear the priority interrupted flag of the current thread and return its previous value.

Returns:
previous value of priority interrupted flag: nonzero if the thread had been priority interrupted.

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

Create a new OS thread.

The created thread is attached to the threading library.

Unlike POSIX, this doesn't require an attributes structure. Instead, any interesting attributes (e.g. stacksize) are passed in with the arguments.

Parameters:
[out] handle a pointer to a hythread_t which will point to the thread (if successfully created)
[in] stacksize the size of the new thread's stack (bytes)
0 indicates use default size
[in] priority priorities range from HYTHREAD_PRIORITY_MIN to HYTHREAD_PRIORITY_MAX (inclusive)
[in] suspend set to non-zero to create the thread in a suspended state.
[in] entrypoint pointer to the function which the thread will run
[in] entryarg a value to pass to the entrypoint function
Returns:
0 on success or negative value on failure
See also:
hythread_exit, hythread_resume

UDATA VMCALL hythread_current_stack_free ( void   ) 

Return the remaining useable bytes of the current thread's OS stack.

Returns:
OS stack free size in bytes, 0 if it cannot be determined.

void VMCALL hythread_detach ( hythread_t  thread  ) 

Detaches the current thread from the threading library.

Detach must only be called by an attached thread. The actual parameter must be the the current thread's hythread_t, or NULL (in which case this function retrieves and uses the current thread's hythread_t). This function cannot be used to detach an arbitrary thread.

When detached, internal resources associated with the thread are freed and the hythread_t structure becomes invalid.

Parameters:
[in] thread the hythread_t of the current thread to be detached, or NULL meaning the current thread struct is looked-up and detached.
Returns:
none
See also:
hythread_attach

void VMCALL NORETURN hythread_exit ( hythread_monitor_t  monitor  ) 

Exit the current thread.

If the thread has been detached, it is destroyed.

If monitor is not NULL, the monitor will be exited before the thread terminates. This is useful if the thread wishes to signal its termination to a watcher, since it exits the monitor and terminates the thread without ever returning control to the thread's routine, which might be running in a DLL which is about to be closed.

Parameters:
[in] monitor monitor to be exited before exiting (ignored if NULL)
Returns:
none

UDATA* VMCALL hythread_global ( char *  name  ) 

Fetch or create a 'named global'.

Return a pointer to the data associated with a named global with the specified name.
A new named global is created if a named global with the specified name can't be found.

Parameters:
[in] name name of named global to read/create
Returns:
a pointer to a UDATA associated with name
0 on failure.

void VMCALL hythread_init ( hythread_library_t  lib  ) 

Initialize a Hy threading library.

Note:
This must only be called once.
If any OS threads were created before calling this function, they must be attached using hythread_attach before accessing any Hy thread library functions.

Parameters:
[in] lib pointer to the Hy thread library to be initialized (non-NULL)
Returns:
The Hy thread library's initStatus will be set to 0 on success or a negative value on failure.
See also:
hythread_attach, hythread_shutdown

void VMCALL hythread_interrupt ( hythread_t  thread  ) 

Interrupt a thread.

If the thread is currently blocked (i.e. waiting on a monitor_wait or sleeping) resume the thread and cause it to return from the blocking function with HYTHREAD_INTERRUPTED.

Parameters:
[in] thread a thead to be interrupted
Returns:
none

UDATA VMCALL hythread_interrupted ( hythread_t  thread  ) 

Return the value of a thread's interrupted flag.

Parameters:
[in] thread thread to be queried
Returns:
0 if not interrupted, non-zero if interrupted

UDATA VMCALL hythread_lib_clear_flags ( UDATA  flags  ) 

Clear specified threading library global flags.

See also:
hythread_lib_set_flags, hythread_lib_get_flags
Parameters:
[in] flags flags to be cleared (bit vector: 1 means clear the flag, 0 means ignore)
Returns:
old flags values

UDATA VMCALL hythread_lib_get_flags (  ) 

Get threading library global flags.

Returns the flags for the threading library associated with the current thread.

Note:
: assumes caller has global lock
See also:
hythread_lib_clear_flags, hythread_lib_set_flags, hythread_lib_lock
Returns:
current flags value

void VMCALL hythread_lib_lock ( hythread_t  self  ) 

Acquire the threading library's global lock.

Note:
This must not be called recursively by a thread that already owns the global lock.
Parameters:
[in] self hythread_t for the current thread
Returns:
none
See also:
hythread_lib_unlock

UDATA VMCALL hythread_lib_set_flags ( UDATA  flags  ) 

Set threading library global flags.

Sets the flags for the threading library associated with the current thread.

Parameters:
[in] flags flags to be set (bit vector: 1 means set the flag, 0 means ignore)
Returns:
old flags values
See also:
hythread_lib_clear_flags, hythread_lib_get_flags

void VMCALL hythread_lib_unlock ( hythread_t  self  ) 

Release the threading library's global lock.

Note:
This must be called only by the thread that currently has the global lock locked.
Parameters:
[in] self hythread_t for the current thread
Returns:
none
See also:
hythread_lib_lock

IDATA VMCALL hythread_monitor_destroy ( hythread_monitor_t  monitor  ) 

Destroy a monitor.

Destroying a monitor frees the internal resources associated with it.

Note:
A monitor must NOT be destroyed if threads are waiting on it, or if it is currently owned.
Parameters:
[in] monitor a monitor to be destroyed
Returns:
0 on success or non-0 on failure (the monitor is in use)
See also:
hythread_monitor_init_with_name

IDATA VMCALL hythread_monitor_enter ( hythread_monitor_t  monitor  ) 

Enter a monitor.

A thread may re-enter a monitor it owns multiple times, but must exit the monitor the same number of times before any other thread wanting to enter the monitor is permitted to continue.

Parameters:
[in] monitor a monitor to be entered
Returns:
0 on success
HYTHREAD_PRIORITY_INTERRUPTED if the thread was priority interrupted while blocked
See also:
hythread_monitor_enter_using_threadId, hythread_monitor_exit, hythread_monitor_exit_using_threadId

IDATA VMCALL hythread_monitor_enter_using_threadId ( hythread_monitor_t  monitor,
hythread_t  threadId 
)

Enter a monitor.

This is a slightly faster version of hythread_monitor_enter because the hythread_t for the current thread doesn't have to be looked up

Parameters:
[in] monitor a monitor to be entered
[in] threadId hythread_t for the current thread
Returns:
0 on success
HYTHREAD_PRIORITY_INTERRUPTED if the thread was priority interrupted while blocked
See also:
hythread_monitor_enter, hythread_monitor_exit, hythread_monitor_exit_using_threadId

IDATA VMCALL hythread_monitor_exit ( hythread_monitor_t  monitor  ) 

Exit a monitor.

Exit a monitor, and if the owning count is zero, release it.

Parameters:
[in] monitor a monitor to be exited
Returns:
0 on success,
HYTHREAD_ILLEGAL_MONITOR_STATE if the current thread does not own the monitor
See also:
hythread_monitor_exit_using_threadId, hythread_monitor_enter, hythread_monitor_enter_using_threadId

IDATA VMCALL hythread_monitor_exit_using_threadId ( hythread_monitor_t  monitor,
hythread_t  threadId 
)

Exit a monitor.

This is a slightly faster version of hythread_monitor_exit because the hythread_t for the current thread doesn't have to be looked up

Parameters:
[in] monitor a monitor to be exited
[in] threadId hythread_t for the current thread
Returns:
0 on success
HYTHREAD_ILLEGAL_MONITOR_STATE if the current thread does not own the monitor
See also:
hythread_monitor_exit, hythread_monitor_enter, hythread_monitor_enter_using_threadId

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

Acquire and initialize a new monitor from the threading library.

Parameters:
[out] handle pointer to a hythread_monitor_t to be set to point to the new monitor
[in] flags initial flag values for the monitor
[in] name pointer to a C string with a description of how the monitor will be used (may be NULL)
If non-NULL, the C string must be valid for the entire life of the monitor
Returns:
0 on success or negative value on failure
See also:
hythread_monitor_destroy

IDATA VMCALL hythread_monitor_notify ( hythread_monitor_t  monitor  ) 

Notify a single thread waiting on a monitor.

A thread is considered to be waiting on the monitor if it is currently blocked while executing hythread_monitor_wait on the monitor.

If no threads are waiting, no action is taken.

Parameters:
[in] monitor a monitor to be signaled
Returns:
0 once the monitor has been signaled
HYTHREAD_ILLEGAL_MONITOR_STATE if the current thread does not own the monitor
See also:
hythread_monitor_notify_all, hythread_monitor_enter, hythread_monitor_wait

IDATA VMCALL hythread_monitor_notify_all ( hythread_monitor_t  monitor  ) 

Notify all threads waiting on a monitor.

A thread is considered to be waiting on the monitor if it is currently blocked while executing hythread_monitor_wait on the monitor.

If no threads are waiting, no action is taken.

Parameters:
[in] monitor a monitor to be signaled
Returns:
0 once the monitor has been signaled
HYTHREAD_ILLEGAL_MONITOR_STATE if the current thread does not own the monitor
See also:
hythread_monitor_notify, hythread_monitor_enter, hythread_monitor_wait

UDATA VMCALL hythread_monitor_num_waiting ( hythread_monitor_t  monitor  ) 

Returns how many threads are currently waiting on a monitor.

Note:
This can only be called by the owner of this monitor.
Parameters:
[in] monitor a monitor
Returns:
number of threads waiting on the monitor (>=0)

IDATA VMCALL hythread_monitor_try_enter ( hythread_monitor_t  monitor  ) 

Attempt to enter a monitor without blocking.

If the thread must block before it enters the monitor this function returns immediately with a negative value to indicate failure.

Parameters:
[in] monitor a monitor
Returns:
0 on success or negative value on failure
See also:
hythread_monitor_try_enter_using_threadId

IDATA VMCALL hythread_monitor_try_enter_using_threadId ( hythread_monitor_t  monitor,
hythread_t  threadId 
)

Attempt to enter a monitor without blocking.

If the thread must block before it enters the monitor this function returns immediately with a negative value to indicate failure.

This is a slightly faster version of hythread_monitor_try_enter because the current thread's hythread_t doesn't have to be looked up.

Parameters:
[in] monitor a monitor
[in] threadId the current thread
Returns:
0 on success or negative value on failure
See also:
hythread_monitor_try_enter

IDATA VMCALL hythread_monitor_wait ( hythread_monitor_t  monitor  ) 

Wait on a monitor until notified.

Release the monitor, wait for a signal (notification), then re-acquire the monitor.

Parameters:
[in] monitor a monitor to be waited on
Returns:
0 if the monitor has been waited on, notified, and reobtained
HYTHREAD_INVALID_ARGUMENT if millis or nanos is out of range (millis or nanos < 0, or nanos >= 1E6)
HYTHREAD_ILLEGAL_MONITOR_STATE if the current thread does not own the monitor
See also:
hythread_monitor_wait_interruptable, hythread_monitor_wait_timed, hythread_monitor_enter

IDATA VMCALL hythread_monitor_wait_interruptable ( hythread_monitor_t  monitor,
I_64  millis,
IDATA  nanos 
)

Wait on a monitor until notified, interrupted (priority or normal), or timed out.

A timeout of 0 (0ms, 0ns) indicates wait indefinitely.

If 'interruptable' is non-zero, the wait may be interrupted by one of the interrupt functions. (i.e. hythread_interrupt, hythread_priority_interrupt);

Parameters:
[in] monitor a monitor to be waited on
[in] millis >=0
[in] nanos >=0
[in] interruptable non-zero if the wait is to be interruptable
Returns:
0 the monitor has been waited on, notified, and reobtained
HYTHREAD_INVALID_ARGUMENT if millis or nanos is out of range (millis or nanos < 0, or nanos >= 1E6)
HYTHREAD_ILLEGAL_MONITOR_STATE if the current thread does not own the monitor
HYTHREAD_INTERRUPTED if the thread was interrupted while waiting
HYTHREAD_PRIORITY_INTERRUPTED if the thread was priority interrupted while waiting, or while re-obtaining the monitor
HYTHREAD_TIMED_OUT if the timeout expired
See also:
hythread_monitor_wait, hythread_monitor_wait_timed, hythread_monitor_enter

hythread_interrupt, hythread_priority_interrupt *

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

Wait on a monitor until notified or timed out.

A timeout of 0 (0ms, 0ns) indicates wait indefinitely.

Parameters:
[in] monitor a monitor to be waited on
[in] millis >=0
[in] nanos >=0
Returns:
0 the monitor has been waited on, notified, and reobtained
HYTHREAD_INVALID_ARGUMENT millis or nanos is out of range (millis or nanos < 0, or nanos >= 1E6)
HYTHREAD_ILLEGAL_MONITOR_STATE the current thread does not own the monitor
HYTHREAD_TIMED_OUT the timeout expired
See also:
hythread_monitor_wait, hythread_monitor_wait_interruptable, hythread_monitor_enter

IDATA VMCALL hythread_park ( I_64  millis,
IDATA  nanos 
)

'Park' the current thread.

Stop the current thread from executing until it is unparked, interrupted, or the specified timeout elapses.

Unlike wait or sleep, the interrupted flag is NOT cleared by this API.

Parameters:
[in] millis 
[in] nanos 
Returns:
0 if the thread is unparked HYTHREAD_INTERRUPTED if the thread was interrupted while parked
HYTHREAD_PRIORITY_INTERRUPTED if the thread was priority interrupted while parked
HYTHREAD_TIMED_OUT if the timeout expired
See also:
hythread_unpark

void VMCALL hythread_priority_interrupt ( hythread_t  thread  ) 

Priority interrupt a thread.

If the thread is currently blocked (i.e. waiting on a monitor_wait or sleeping) resume the thread and return from the blocking function with HYTHREAD_PRIORITY_INTERRUPTED

Parameters:
[in] thread a thead to be priority interrupted
Returns:
none

UDATA VMCALL hythread_priority_interrupted ( hythread_t  thread  ) 

Return the value of a thread's priority interrupted flag.

Parameters:
[in] thread thread to be queried
Returns:
0 if not priority interrupted, non-zero if priority interrupted flag set

void VMCALL hythread_resume ( hythread_t  thread  ) 

Resume a thread.

Take a threads out of the suspended state.

If the thread is not suspended, no action is taken.

Parameters:
[in] thread a thread to be resumed
Returns:
none
See also:
hythread_create, hythread_suspend

hythread_t VMCALL hythread_self ( void   ) 

Return the hythread_t for the current thread.

Note:
Must be called only by an attached thread
Returns:
hythread_t for the current thread
See also:
hythread_attach

IDATA VMCALL hythread_set_priority ( hythread_t  thread,
UDATA  priority 
)

Set a thread's execution priority.

Parameters:
[in] thread a thread
[in] priority Use the following symbolic constants for priorities:
HYTHREAD_PRIORITY_MAX
HYTHREAD_PRIORITY_USER_MAX
HYTHREAD_PRIORITY_NORMAL
HYTHREAD_PRIORITY_USER_MIN
HYTHREAD_PRIORITY_MIN
Returns:
0 on success or negative value on failure (priority wasn't changed)

void VMCALL hythread_shutdown ( void   ) 

Shut down the Hy threading library associated with the current thread.

Returns:
none
See also:
hythread_init

IDATA VMCALL hythread_sleep ( I_64  millis  ) 

Suspend the current thread from executing for at least the specified time.

Parameters:
[in] millis minimum number of milliseconds to sleep
Returns:
0 on success
HYTHREAD_INVALID_ARGUMENT if millis < 0
See also:
hythread_sleep_interruptable

IDATA VMCALL hythread_sleep_interruptable ( I_64  millis,
IDATA  nanos 
)

Suspend the current thread from executing for at least the specified time.

Parameters:
[in] millis 
[in] nanos 
Returns:
0 on success
HYTHREAD_INVALID_ARGUMENT if the arguments are invalid
HYTHREAD_INTERRUPTED if the sleep was interrupted
See also:
hythread_sleep

void VMCALL hythread_suspend ( void   ) 

Suspend the current thread.

Stop the current thread from executing until it is resumed.

Returns:
none
See also:
hythread_resume

IDATA VMCALL hythread_tls_alloc ( hythread_tls_key_t *  handle  ) 

Allocate a thread local storage (TLS) key.

Create and return a new, unique key for thread local storage.

Note:
The hande returned will be >=0, so it is safe to test the handle against 0 to see if it's been allocated yet.
Parameters:
[out] handle pointer to a key to be initialized with a key value
Returns:
0 on success or negative value if a key could not be allocated (i.e. all TLS has been allocated)
See also:
hythread_tls_free, hythread_tls_set

IDATA VMCALL hythread_tls_alloc_with_finalizer ( hythread_tls_key_t *  handle,
hythread_tls_finalizer_t  finalizer 
)

Allocate a thread local storage (TLS) key.

Create and return a new, unique key for thread local storage.

Note:
The hande returned will be >=0, so it is safe to test the handle against 0 to see if it's been allocated yet.
Parameters:
[out] handle pointer to a key to be initialized with a key value
[in] a finalizer function which will be invoked when a thread is detached or terminates if the thread's TLS entry for this key is non-NULL
Returns:
0 on success or negative value if a key could not be allocated (i.e. all TLS has been allocated)
See also:
hythread_tls_free, hythread_tls_set

IDATA VMCALL hythread_tls_free ( hythread_tls_key_t  key  ) 

Release a TLS key.

Release a TLS key previously allocated by hythread_tls_alloc.

Parameters:
[in] key TLS key to be freed
Returns:
0 on success or negative value on failure
See also:
hythread_tls_alloc, hythread_tls_set

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

Set a thread's TLS value.

Parameters:
[in] thread a thread
[in] key key to have TLS value set (any value returned by hythread_alloc)
[in] value value to be stored in TLS
Returns:
0 on success or negative value on failure
See also:
hythread_tls_alloc, hythread_tls_free, hythread_tls_get

void VMCALL hythread_unpark ( hythread_t  thread  ) 

'Unpark' the specified thread.

If the thread is parked, it will return from park. If the thread is not parked, its 'UNPARKED' flag will be set, and it will return immediately the next time it is parked.

Note that unparks are not counted. Unparking a thread once is the same as unparking it n times.

See also:
hythread_park

void VMCALL hythread_yield ( void   ) 

Yield the processor.

Returns:
none


Genereated on Tue Dec 9 14:13:00 2008 by Doxygen.

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