diff options
author | Joe Watkins <krakjoe@php.net> | 2019-03-29 08:01:31 +0100 |
---|---|---|
committer | Joe Watkins <krakjoe@php.net> | 2019-03-29 19:06:02 +0100 |
commit | 072eb6dd77b079a6f90ca5b155f9b0add1b5f2d4 (patch) | |
tree | b808bffb52c45033bfae2cb09d9dbd0283d0e0cf /TSRM/TSRM.c | |
parent | 61ad294f26fa7941a26361a68cf6a01b8a2c3e4f (diff) | |
download | php-git-072eb6dd77b079a6f90ca5b155f9b0add1b5f2d4.tar.gz |
tsrm environment lock
Diffstat (limited to 'TSRM/TSRM.c')
-rw-r--r-- | TSRM/TSRM.c | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/TSRM/TSRM.c b/TSRM/TSRM.c index 670c260678..d70c09d2b5 100644 --- a/TSRM/TSRM.c +++ b/TSRM/TSRM.c @@ -52,7 +52,8 @@ static int resource_types_table_size; static size_t tsrm_reserved_pos = 0; static size_t tsrm_reserved_size = 0; -static MUTEX_T tsmm_mutex; /* thread-safe memory manager mutex */ +static MUTEX_T tsmm_mutex; /* thread-safe memory manager mutex */ +static MUTEX_T tsrm_env_mutex; /* tsrm environ mutex */ /* New thread handlers */ static tsrm_thread_begin_func_t tsrm_new_thread_begin_handler = NULL; @@ -168,6 +169,8 @@ TSRM_API int tsrm_startup(int expected_threads, int expected_resources, int debu tsrm_reserved_pos = 0; tsrm_reserved_size = 0; + tsrm_env_mutex = tsrm_mutex_alloc(); + return 1; }/*}}}*/ @@ -214,6 +217,8 @@ TSRM_API void tsrm_shutdown(void) } tsrm_mutex_free(tsmm_mutex); tsmm_mutex = NULL; + tsrm_mutex_free(tsrm_env_mutex); + tsrm_env_mutex = NULL; TSRM_ERROR((TSRM_ERROR_LEVEL_CORE, "Shutdown TSRM")); if (tsrm_error_file!=stderr) { fclose(tsrm_error_file); @@ -237,6 +242,15 @@ TSRM_API void tsrm_shutdown(void) tsrm_reserved_size = 0; }/*}}}*/ +/* {{{ */ +/* environ lock api */ +TSRM_API int tsrm_env_lock() { + return tsrm_mutex_lock(tsrm_env_mutex); +} + +TSRM_API int tsrm_env_unlock() { + return tsrm_mutex_unlock(tsrm_env_mutex); +} /* }}} */ /* enlarge the arrays for the already active threads */ static void tsrm_update_active_threads(void) |