cvs: TSRM / TSRM.h
| From: | Sterling Hughes | Date: | Sun, 27 Apr 2003 21:57:07 +0000 |
| Subject: | cvs: TSRM / TSRM.h | ||
| Groups: | php.zend-engine.cvs | ||
| Request: | Send a blank email to php-zend-engine-cvs+get-1176@lists.php.net to get a copy of this message | ||
sterling Sun Apr 27 17:57:07 2003 EDT
Modified files:
/TSRM TSRM.h
Log:
add TSRMLS_FETCH_CTX which allows you to map a variable to a ts context.
This is useful when you are mapping callbacks, you can simply associate
a struct member to a thread context:
void mycallback(my_struct *user) {
TSRMLS_FETCH_CTX(user->thread_ctx);
}
Index: TSRM/TSRM.h
diff -u TSRM/TSRM.h:1.38 TSRM/TSRM.h:1.39
--- TSRM/TSRM.h:1.38 Mon Feb 17 08:27:15 2003
+++ TSRM/TSRM.h Sun Apr 27 17:57:07 2003
@@ -149,6 +149,7 @@
#define TSRM_UNSHUFFLE_RSRC_ID(rsrc_id) ((rsrc_id)-1)
#define TSRMLS_FETCH() void ***tsrm_ls = (void ***) ts_resource_ex(0, NULL)
+#define TSRMLS_FETCH_FROM_CTX(ctx) void ***tsrm_ls = (void ***) ctx
#define TSRMG(id, type, element) (((type) (*((void ***)
tsrm_ls))[TSRM_UNSHUFFLE_RSRC_ID(id)])->element)
#define TSRMLS_D void ***tsrm_ls
#define TSRMLS_DC , TSRMLS_D