Qore Programming Language Reference Manual
0.8.11.1
|
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 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 | Qore::getAllThreadCallStacks () |
Returns a hash of call stacks keyed by each TID (thread ID) More... | |
hash | Qore::get_all_thread_data () |
Returns the entire thread-local data hash. More... | |
any | 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... | |
*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 | 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 | Qore::remove_thread_data (list 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... | |
nothing | Qore::save_thread_data (hash 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, any 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... | |
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_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 | Qore::thread_list () |
Returns a list of all current thread IDs. More... | |
nothing | Qore::throwThreadResourceExceptions () |
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 | 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 Qore::get_all_thread_data | ( | ) |
Returns the entire thread-local data hash.
any Qore::get_thread_data | ( | string | key | ) |
Returns the value of the thread-local data attached to the key passed.
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.
*TimeZone Qore::get_thread_tz | ( | ) |
Returns any TimeZone set for the current thread, NOTHING if none is set.
hash Qore::getAllThreadCallStacks | ( | ) |
Returns a hash of call stacks keyed by each 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 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 |
hash Qore::remove_thread_data | ( | list | 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.
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 |
nothing Qore::save_thread_data | ( | hash | 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, |
any | 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 |
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.
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.
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
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.
list Qore::thread_list | ( | ) |
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
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.