Deletes all keys in the thread-local data hash.
delete_all_thread_data()
delete_all_thread_data();
Not available with PO_NO_THREAD_CONTROL
Table 3.371. Arguments and Return Values for delete_all_thread_data()
Argument Type | Return Type | Description |
---|---|---|
n/a | n/a | Deletes all keys in the thread-local data hash. |
This function does not throw any exceptions.
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. See remove_thread_data() for a similar function that does not explicitly destroy objects in the thread-local data hash.
delete_thread_data(key_string, [key_string, ...]
)
delete_thread_data("key1", "key2");
Not available with PO_NO_THREAD_CONTROL
Table 3.372. Arguments and Return Values for delete_thread_data()
Arguments | Return Values | Description |
---|---|---|
String, [String ...] | n/a | Deletes the data associated to one or more keys in the thread-local data hash. |
This function does not throw any exceptions, however any objects deleted could throw exceptions in their destructors.
Returns the entire thread-local data hash.
get_all_thread_data()
$hash = get_all_thread_data();
Not available with PO_NO_THREAD_CONTROL
Table 3.373. Arguments and Return Values for get_all_thread_data()
Argument Type | Return Type | Description |
---|---|---|
n/a | Hash | Returns the entire thread-local data hash. |
This function does not throw any exceptions.
Returns a hash of call stacks keyed by each TID (thread ID). The availability of this function depends on an optional debugging feature in the Qore library (maintaining run-time thread call stacks incurrs a performance penalty, therefore this option is normally only available in debugging builds of Qore); the function is only available if the constant HAVE_RUNTIME_THREAD_STACK_TRACE
is True. See Library Option Constants for a list of all option constants.
getAllThreadCallStacks()
$hash = getAllThreadCallStacks();
Not available with PO_NO_THREAD_CONTROL
Table 3.374. Arguments and Return Values for getAllThreadCallStacks()
Argument Type | Return Type | Description |
---|---|---|
n/a | Hash | Returns a hash of call stacks keyed by each TID (thread ID). See Call Stack Description for a description of the call stack format. |
Table 3.375. Exceptions Thrown by getAllThreadCallStacks()
err | desc |
---|---|
| This exception is thrown when the function is not available; for maximum portability, check the constant |
Returns the value of the thread-local data attached to the key passed.
get_thread_data(key_string
)
$data = get_thread_data("key1");
Not available with PO_NO_THREAD_CONTROL
Table 3.376. Arguments and Return Values for get_thread_data()
Argument Type | Return Type | Description |
---|---|---|
String | depends on key | Returns the value of the thread-local data attached to the key passed. |
This function does not throw any exceptions.
Returns the Qore thread ID (TID) of the current thread.
gettid()
$tid = gettid();
Table 3.377. Arguments and Return Values for gettid()
Argument Type | Return Type | Description |
---|---|---|
n/a | Integer | Returns the Qore thread ID (TID) of the current thread. |
This function does not throw any exceptions.
Returns the current number of threads in the process (not including the special signal handling thread).
num_threads()
$num = num_threads();
Table 3.378. Arguments and Return Values for num_threads()
Argument Type | Return Type | Description |
---|---|---|
n/a | Integer | Returns the current number of threads in the process. |
This function does not throw any exceptions.
Removes the data associated to one or more keys in the thread-local data hash. For a similar function that also explicitly destroys objects, see delete_thread_data.
remove_thread_data(key_string, [key_string, ...]
)
remove_thread_data("key1", "key2");
Not available with PO_NO_THREAD_CONTROL
Table 3.379. Arguments and Return Values for remove_thread_data()
Arguments | Return Values | Description |
---|---|---|
String, [String ...] | n/a | Removes the data associated to one or more keys in the thread-local data hash. |
This function does not throw any exceptions.
Saves the data passed against the key passed in thread-local storage.
save_thread_data(key_string, value_expression
)
save_thread_data("key1", $value);
Not available with PO_NO_THREAD_CONTROL
Table 3.380. Arguments and Return Values for save_thread_data()
Argument Type | Return Type | Description |
---|---|---|
String, Any | n/a | Saves the data passed against the key passed in thread-local storage. |
This function does not throw any exceptions.
Returns a list of all current thread IDs. Note that the special signal handling thread with TID 0 is never included in this list.
thread_list()
$list = thread_list();
Table 3.381. Arguments and Return Values for thread_list()
Argument Type | Return Type | Description |
---|---|---|
n/a | List | Returns a list of all current thread IDs |
This function does not throw any 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).
throwThreadResourceExceptions()
try { throwThreadResourceExceptions(); } catch ($ex) { # ... log or handle exceptions }
Not available with PO_NO_THREAD_CONTROL
Table 3.382. Arguments and Return Values for throwThreadResourceExceptions()
Argument Type | Return Type | Description |
---|---|---|
n/a | n/a | This function returns no value. |
This function can throw any exception thrown by a thread resource handler.