summaryrefslogtreecommitdiff
path: root/TSRM/TSRM.c
diff options
context:
space:
mode:
authorZeev Suraski <zeev@php.net>2000-06-16 14:38:05 +0000
committerZeev Suraski <zeev@php.net>2000-06-16 14:38:05 +0000
commit33f94999756591d98d9061105496e7255e4f43da (patch)
tree14cb5197b1077545d1ef51bb772de1b614cb92c1 /TSRM/TSRM.c
parent84eb48f0a1fd0a8be0f09ad3b77697922d2b5bfb (diff)
downloadphp-git-33f94999756591d98d9061105496e7255e4f43da.tar.gz
Make it possible to access other threads' local storage. Only use it if you have a clear
knowledge of what you're doing!
Diffstat (limited to 'TSRM/TSRM.c')
-rw-r--r--TSRM/TSRM.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/TSRM/TSRM.c b/TSRM/TSRM.c
index b95384b9e3..f1fdd3a85e 100644
--- a/TSRM/TSRM.c
+++ b/TSRM/TSRM.c
@@ -206,13 +206,18 @@ static void allocate_new_resource(tsrm_tls_entry **thread_resources_ptr, THREAD_
/* fetches the requested resource for the current thread */
-void *ts_resource(ts_rsrc_id id)
+void *ts_resource_ex(ts_rsrc_id id, THREAD_T *th_id)
{
- THREAD_T thread_id = tsrm_thread_id();
+ THREAD_T thread_id;
int hash_value;
tsrm_tls_entry *thread_resources;
void *resource;
+ if (th_id) {
+ thread_id = *th_id;
+ } else {
+ thread_id = tsrm_thread_id();
+ }
tsrm_debug("Fetching resource id %d for thread %ld\n", id, (long) thread_id);
tsrm_mutex_lock(tsmm_mutex);