Qore Programming Language Reference Manual
1.7.0
|
Functions | |
nothing | Qore::delete_all_thread_data () |
Deletes all keys in the thread-local data hash. More... | |
nothing | Qore::delete_thread_data (...) |
Deletes the data associated to one or more keys in the thread-local data hash; if the data is an object, then it is destroyed. More... | |
nothing | Qore::delete_thread_data (list< softstring > l) |
Deletes the data associated to one or more keys in the thread-local data hash; if the data is an object, then it is destroyed. More... | |
hash< string, list< hash< CallStackInfo > > > | Qore::getAllThreadCallStacks () |
Returns a hash of lists of CallStackInfo hashes keyed by TID (thread ID) More... | |
hash< string, list< hash< CallStackInfo > > > | Qore::get_all_thread_call_stacks () |
Returns a hash of lists of CallStackInfo hashes keyed by TID (thread ID) More... | |
hash< auto > | Qore::get_all_thread_data () |
Returns the entire thread-local data hash. More... | |
int | Qore::get_default_thread_stack_size () |
returns the default thread stack size More... | |
int | Qore::get_stack_size () |
returns the current thread's stack size More... | |
list< hash< CallStackInfo > > | Qore::get_thread_call_stack () |
Returns a list of CallStackInfo hashes for the current TID (thread ID); because it is always from the same thread being read, no locking is applied as in get_all_thread_call_stacks() More... | |
auto | Qore::get_thread_data (string key) |
Returns the value of the thread-local data attached to the key passed. More... | |
nothing | Qore::get_thread_data () |
This function variant does nothing at all; it is only included for backwards-compatibility with qore prior to version 0.8.0 for functions that would ignore type errors in arguments. More... | |
*string | Qore::get_thread_name () |
returns the current thread's descriptive name if set or NOTHING if not More... | |
*TimeZone | Qore::get_thread_tz () |
Returns any TimeZone set for the current thread, NOTHING if none is set. More... | |
int | Qore::gettid () |
Returns the Qore thread ID (TID) of the current thread. More... | |
nothing | Qore::mark_thread_resources () |
Marks thread resources so that any thread resources left allocated after this call will be cleaned up when throw_thread_resource_exceptions_to_mark() is called. More... | |
int | Qore::num_threads () |
Returns the current number of threads in the process (not including the special signal handling thread) More... | |
*hash< auto > | Qore::remove_thread_data (...) |
Removes the data associated to one or more keys in the thread-local data hash and returns the data removed. More... | |
hash< auto > | Qore::remove_thread_data (list< softstring > l) |
Removes the data associated to one or more keys in the thread-local data hash from a literal list passed as the first argument and returns the data removed. More... | |
bool | Qore::remove_thread_resource (AbstractThreadResource resource) |
removes a thread resource from the current thread More... | |
bool | Qore::remove_thread_resource (code resource) |
removes a callable thread resource from the current thread More... | |
nothing | Qore::save_thread_data (hash< auto > h) |
Saves the data passed in the thread-local hash; all keys are merged into the thread-local hash, overwriting any information that may have been there before. More... | |
nothing | Qore::save_thread_data (string key, auto value) |
Saves the data passed against the key passed as an argument in thread-local storage. More... | |
nothing | Qore::save_thread_data () |
This function variant does nothing at all; it is only included for backwards-compatibility with qore prior to version 0.8.0 for functions that would ignore type errors in arguments. More... | |
int | Qore::set_default_thread_stack_size (int size) |
sets the default thread stack size for new threads created after this call and returns the stack size actually set More... | |
bool | Qore::set_thread_init (*code init) |
Sets a call reference or closure to run every time a new thread is started. More... | |
nothing | Qore::set_thread_name (string name) |
sets the current thread's descriptive name More... | |
nothing | Qore::set_thread_resource (AbstractThreadResource resource) |
sets a thread resource for the current thread More... | |
nothing | Qore::set_thread_resource (code resource, auto arg) |
sets a callable thread resource for the current thread with an optional argument More... | |
nothing | Qore::set_thread_tz (TimeZone zone) |
Sets the default time zone for the current thread. More... | |
nothing | Qore::set_thread_tz () |
Clears the thread-local time zone for the current thread; after this call TimeZone::get() will return the value set for the current Program. More... | |
list< int > | Qore::thread_list () |
Returns a list of all current thread IDs. More... | |
nothing | Qore::thread_yield () |
yields the current thread so other threads can be scheduled and run More... | |
nothing | Qore::throwThreadResourceExceptions () |
Immediately runs all thread resource cleanup routines for the current thread and throws all associated exceptions. More... | |
nothing | Qore::throw_thread_resource_exceptions () |
Immediately runs all thread resource cleanup routines for the current thread and throws all associated exceptions. More... | |
bool | Qore::throw_thread_resource_exceptions_to_mark () |
Immediately runs all thread resource cleanup routines for the current thread for thread resources created since the last call to mark_thread_resources() and throws all associated exceptions. More... | |
Threading functions
nothing Qore::delete_all_thread_data | ( | ) |
Deletes all keys in the thread-local data hash.
nothing Qore::delete_thread_data | ( | ... | ) |
Deletes the data associated to one or more keys in the thread-local data hash; if the data is an object, then it is destroyed.
... | Deletes the data associated to one or more keys in the thread-local data hash corresponding to each string argument in the top-level argument list; arguments are converted to strings if necessary |
nothing Qore::delete_thread_data | ( | list< softstring > | l | ) |
Deletes the data associated to one or more keys in the thread-local data hash; if the data is an object, then it is destroyed.
l | a list of key names for deleting keys in the thread-local data hash; values are converted to strings if necessary |
hash<string,list<hash<CallStackInfo> > > Qore::get_all_thread_call_stacks | ( | ) |
Returns a hash of lists of CallStackInfo hashes keyed by TID (thread ID)
hash<auto> Qore::get_all_thread_data | ( | ) |
Returns the entire thread-local data hash.
int Qore::get_default_thread_stack_size | ( | ) |
returns the default thread stack size
int Qore::get_stack_size | ( | ) |
returns the current thread's stack size
list<hash<CallStackInfo> > Qore::get_thread_call_stack | ( | ) |
Returns a list of CallStackInfo hashes for the current TID (thread ID); because it is always from the same thread being read, no locking is applied as in get_all_thread_call_stacks()
nothing Qore::get_thread_data | ( | ) |
This function variant does nothing at all; it is only included for backwards-compatibility with qore prior to version 0.8.0 for functions that would ignore type errors in arguments.
auto Qore::get_thread_data | ( | string | key | ) |
Returns the value of the thread-local data attached to the key passed.
*string Qore::get_thread_name | ( | ) |
returns the current thread's descriptive name if set or NOTHING if not
qore/
tid where tid is the current thread ID*TimeZone Qore::get_thread_tz | ( | ) |
Returns any TimeZone set for the current thread, NOTHING if none is set.
hash<string,list<hash<CallStackInfo> > > Qore::getAllThreadCallStacks | ( | ) |
Returns a hash of lists of CallStackInfo hashes keyed by TID (thread ID)
int Qore::gettid | ( | ) |
Returns the Qore thread ID (TID) of the current thread.
nothing Qore::mark_thread_resources | ( | ) |
Marks thread resources so that any thread resources left allocated after this call will be cleaned up when throw_thread_resource_exceptions_to_mark() is called.
When exceptions are thrown by this function, thread-local resources are also cleaned up at the same time.
int Qore::num_threads | ( | ) |
Returns the current number of threads in the process (not including the special signal handling thread)
*hash<auto> Qore::remove_thread_data | ( | ... | ) |
Removes the data associated to one or more keys in the thread-local data hash and returns the data removed.
... | the key names should be given directly in the argument list with this variant. If the given hash keys do not exist in the thread-local data hash, then the given key in the return value will have no value assigned |
Removes the data associated to one or more keys in the thread-local data hash from a literal list passed as the first argument and returns the data removed.
l | a list of key names to remove from the thread-local data hash. If the given hash keys do not exist in the thread-local data hash, then the given key in the return value will have no value assigned |
bool Qore::remove_thread_resource | ( | AbstractThreadResource | resource | ) |
removes a thread resource from the current thread
resource | the thread resource to remove |
bool Qore::remove_thread_resource | ( | code | resource | ) |
removes a callable thread resource from the current thread
resource | the callable thread resource to remove |
nothing Qore::save_thread_data | ( | ) |
This function variant does nothing at all; it is only included for backwards-compatibility with qore prior to version 0.8.0 for functions that would ignore type errors in arguments.
nothing Qore::save_thread_data | ( | hash< auto > | h | ) |
Saves the data passed in the thread-local hash; all keys are merged into the thread-local hash, overwriting any information that may have been there before.
h | a hash of data to save in the thread-local data hash |
nothing Qore::save_thread_data | ( | string | key, |
auto | value | ||
) |
Saves the data passed against the key passed as an argument in thread-local storage.
key | the name of the key in the thread-local hash to save the data against |
value | the value to save in the thread-local hash against the key |
sets the default thread stack size for new threads created after this call and returns the stack size actually set
size | the size in bytes for new threads |
SET-DEFAULT-THREAD-STACK-SIZE-ERROR | an error occurred setting the default thread stack size |
bool Qore::set_thread_init | ( | *code | init | ) |
Sets a call reference or closure to run every time a new thread is started.
This code can be used to initialize global thread-local variables, for example.
init | a call reference or closure to run every time a new thread is started or NOTHING to clear any thread initialization code |
nothing Qore::set_thread_name | ( | string | name | ) |
sets the current thread's descriptive name
name | the new descriptive name for the thread |
nothing Qore::set_thread_resource | ( | AbstractThreadResource | resource | ) |
sets a thread resource for the current thread
resource | the thread resource to set |
nothing Qore::set_thread_resource | ( | code | resource, |
auto | arg | ||
) |
sets a callable thread resource for the current thread with an optional argument
resource | the thread resource handler to set |
arg | an argument to use when calling the thread resource handler |
nothing Qore::set_thread_tz | ( | ) |
Clears the thread-local time zone for the current thread; after this call TimeZone::get() will return the value set for the current Program.
nothing Qore::set_thread_tz | ( | TimeZone | zone | ) |
Sets the default time zone for the current thread.
zone | the TimeZone object for the current thread |
This will cause the TimeZone::get() method to return the given TimeZone when called from the same thread
Returns a list of all current thread IDs.
Note that the special signal handling thread with TID 0 is never included in the list returned by this function
nothing Qore::thread_yield | ( | ) |
yields the current thread so other threads can be scheduled and run
nothing Qore::throw_thread_resource_exceptions | ( | ) |
Immediately runs all thread resource cleanup routines for the current thread and throws all associated exceptions.
This function is particularly useful when used in combination with embedded code in order to catch (and log, for example) thread resource errors (ex: uncommitted transactions, unlocked locks, etc) - this can be used when control returns to the "master" program to ensure that no thread-local resources have been left active.
This function will run all thread resource cleanup routines even if mark_thread_resources() has been called (i.e. it clears all marks as well).
When exceptions are thrown by this function, thread-local resources are also cleaned up at the same time.
bool Qore::throw_thread_resource_exceptions_to_mark | ( | ) |
Immediately runs all thread resource cleanup routines for the current thread for thread resources created since the last call to mark_thread_resources() and throws all associated exceptions.
When exceptions are thrown by this function, thread-local resources are also cleaned up at the same time.
nothing Qore::throwThreadResourceExceptions | ( | ) |
Immediately runs all thread resource cleanup routines for the current thread and throws all associated exceptions.
This function is particularly useful when used in combination with embedded code in order to catch (and log, for example) thread resource errors (ex: uncommitted transactions, unlocked locks, etc) - this can be used when control returns to the "master" program to ensure that no thread-local resources have been left active.
This function will run all thread resource cleanup routines even if mark_thread_resources() has been called (i.e. it clears all marks as well).
When exceptions are thrown by this function, thread-local resources are also cleaned up at the same time.