CVS update: php31/ext/standard
| From: | shane | Date: | Tue, 15 Sep 1998 22:35:40 +0000 |
| Subject: | CVS update: php31/ext/standard | ||
| Groups: | php.dev | ||
| Request: | Send a blank email to php-dev+get-1148@lists.php.net to get a copy of this message | ||
Date: Tuesday September 15, 1998 @ 18:35
Author: shane
Update of /repository/php31/ext/standard
In directory asf:/u2/tmp/cvs-serv9066/ext/standard
Modified Files:
basic_functions.c
Log Message:
thread safe fix on user callable functions
Index: php31/ext/standard/basic_functions.c
diff -c php31/ext/standard/basic_functions.c:2.15 php31/ext/standard/basic_functions.c:2.16
*** php31/ext/standard/basic_functions.c:2.15 Tue Sep 15 14:23:45 1998
--- php31/ext/standard/basic_functions.c Tue Sep 15 18:35:40 1998
***************
*** 82,92 ****
#if PHP_DEBUGGER
extern int _php3_send_error(char *message, char *address);
#endif
! /*FIXME THREAD SAFETY!!!*/
! //#ifndef THREAD_SAFE
static pval *user_compare_func_name;
static HashTable *user_shutdown_function_names;
! //#endif
BEGIN_FUNCTION_ENTRIES(basic_functions)
{"intval", int_value, NULL},
--- 82,92 ----
#if PHP_DEBUGGER
extern int _php3_send_error(char *message, char *address);
#endif
!
! #ifndef THREAD_SAFE
static pval *user_compare_func_name;
static HashTable *user_shutdown_function_names;
! #endif
BEGIN_FUNCTION_ENTRIES(basic_functions)
{"intval", int_value, NULL},
***************
*** 336,343 ****
return FAILURE;
}
#endif
! user_compare_func_name=NULL;
! user_shutdown_function_names=NULL;
return SUCCESS;
}
--- 336,343 ----
return FAILURE;
}
#endif
! GLOBAL(user_compare_func_name)=NULL;
! GLOBAL(user_shutdown_function_names)=NULL;
return SUCCESS;
}
***************
*** 348,356 ****
#if HAVE_PUTENV && !defined(THREAD_SAFE)
_php3_hash_destroy(&putenv_ht);
#endif
! if (user_shutdown_function_names) {
! _php3_hash_destroy(user_shutdown_function_names);
! efree(user_shutdown_function_names);
}
return SUCCESS;
}
--- 348,356 ----
#if HAVE_PUTENV && !defined(THREAD_SAFE)
_php3_hash_destroy(&putenv_ht);
#endif
! if (GLOBAL(user_shutdown_function_names)) {
! _php3_hash_destroy(GLOBAL(user_shutdown_function_names));
! efree(GLOBAL(user_shutdown_function_names));
}
return SUCCESS;
}
***************
*** 1565,1593 ****
void php3_call_shutdown_functions()
{
! if (user_shutdown_function_names) {
! _php3_hash_apply(user_shutdown_function_names, (int(*)(void *))
user_shutdown_function_executor);
}
}
PHP_FUNCTION(register_shutdown_function)
{
pval *arg, shutdown_function_name;
if (ARG_COUNT(ht)!=1 || getParameters(ht, 1, &arg)==FAILURE) {
WRONG_PARAM_COUNT;
}
convert_to_string(arg);
! if (!user_shutdown_function_names) {
! user_shutdown_function_names = (HashTable *) emalloc(sizeof(HashTable));
! _php3_hash_init(user_shutdown_function_names, 0, NULL, (void (*)(void
*))user_shutdown_function_dtor, 0);
}
shutdown_function_name = *arg;
pval_copy_constructor(&shutdown_function_name);
! _php3_hash_next_index_insert(user_shutdown_function_names, &shutdown_function_name,
sizeof(pval), NULL);
}
PHP_FUNCTION(memory_status)
--- 1565,1596 ----
void php3_call_shutdown_functions()
{
! TLS_VARS;
!
! if (GLOBAL(user_shutdown_function_names)) {
! _php3_hash_apply(GLOBAL(user_shutdown_function_names), (int(*)(void *))
user_shutdown_function_executor);
}
}
PHP_FUNCTION(register_shutdown_function)
{
pval *arg, shutdown_function_name;
+ TLS_VARS;
if (ARG_COUNT(ht)!=1 || getParameters(ht, 1, &arg)==FAILURE) {
WRONG_PARAM_COUNT;
}
convert_to_string(arg);
! if (!GLOBAL(user_shutdown_function_names)) {
! GLOBAL(user_shutdown_function_names) = (HashTable *) emalloc(sizeof(HashTable));
! _php3_hash_init(GLOBAL(user_shutdown_function_names), 0, NULL, (void (*)(void
*))user_shutdown_function_dtor, 0);
}
shutdown_function_name = *arg;
pval_copy_constructor(&shutdown_function_name);
! _php3_hash_next_index_insert(GLOBAL(user_shutdown_function_names), &shutdown_function_name,
sizeof(pval), NULL);
}
PHP_FUNCTION(memory_status)
--
PHP Development Mailing List http://www.php.net/
To unsubscribe send an empty message to php-dev-unsubscribe@lists.php.net
For help: php-dev-help@lists.php.net