summaryrefslogtreecommitdiff
path: root/TSRM
diff options
context:
space:
mode:
authorMarcus Boerger <helly@php.net>2004-05-12 22:28:28 (GMT)
committerMarcus Boerger <helly@php.net>2004-05-12 22:28:28 (GMT)
commit88a02ba159cab10d400727920f1ab430c3397fd2 (patch)
tree4af8d27f0437fa9c3009c5abfd12171ef8f0f966 /TSRM
parentc0be906309406816c9432e434bbdb0093ce0a135 (diff)
downloadphp-88a02ba159cab10d400727920f1ab430c3397fd2.tar.gz
- More work on ts_free_id() but still keep it out
Diffstat (limited to 'TSRM')
-rw-r--r--TSRM/TSRM.c15
1 files changed, 11 insertions, 4 deletions
diff --git a/TSRM/TSRM.c b/TSRM/TSRM.c
index 1ae5345..3369c5e 100644
--- a/TSRM/TSRM.c
+++ b/TSRM/TSRM.c
@@ -34,6 +34,9 @@ typedef struct {
size_t size;
ts_allocate_ctor ctor;
ts_allocate_dtor dtor;
+#ifdef MBO_0
+ int done;
+#endif
} tsrm_resource_type;
@@ -159,8 +162,8 @@ TSRM_API void tsrm_shutdown(void)
next_p = p->next;
for (j=0; j<p->count; j++) {
if (p->storage[j]) {
-#if MBO_0
- if (resource_types_table && resource_types_table[j].dtor) {
+#ifdef MBO_0
+ if (resource_types_table && !resource_types_table[j].done && resource_types_table[j].dtor) {
resource_types_table[j].dtor(p->storage[j], &p->storage);
}
#endif
@@ -223,6 +226,9 @@ TSRM_API ts_rsrc_id ts_allocate_id(ts_rsrc_id *rsrc_id, size_t size, ts_allocate
resource_types_table[TSRM_UNSHUFFLE_RSRC_ID(*rsrc_id)].size = size;
resource_types_table[TSRM_UNSHUFFLE_RSRC_ID(*rsrc_id)].ctor = ctor;
resource_types_table[TSRM_UNSHUFFLE_RSRC_ID(*rsrc_id)].dtor = dtor;
+#ifdef MBO_0
+ resource_types_table[TSRM_UNSHUFFLE_RSRC_ID(*rsrc_id)].done = 0;
+#endif
/* enlarge the arrays for the already active threads */
for (i=0; i<tsrm_tls_table_size; i++) {
@@ -424,7 +430,7 @@ void ts_free_thread(void)
/* deallocates all occurrences of a given id */
void ts_free_id(ts_rsrc_id id)
{
-#if MBO_0
+#ifdef MBO_0
int i;
int j = TSRM_UNSHUFFLE_RSRC_ID(id);
@@ -434,7 +440,7 @@ void ts_free_id(ts_rsrc_id id)
if (tsrm_tls_table) {
for (i=0; i<tsrm_tls_table_size; i++) {
- tsrm_tls_entry *p = tsrm_tls_table[i], *next_p;
+ tsrm_tls_entry *p = tsrm_tls_table[i];
while (p) {
if (p->count > j && p->storage[j]) {
@@ -448,6 +454,7 @@ void ts_free_id(ts_rsrc_id id)
}
}
}
+ resource_types_table[j].done = 1;
tsrm_mutex_unlock(tsmm_mutex);