Download src/php/php-src/TSRM/TSRM.h from meddyrat/dis-bench: direct link, hf CLI and curl.
- Browser
- Download file 6.81 kB
-
https://huggingface.co/datasets/meddyrat/dis-bench/resolve/main/src/php/php-src/TSRM/TSRM.h
- Command line
-
hf download hf://datasets/meddyrat/dis-bench/src/php/php-src/TSRM/TSRM.h
-
curl -L -o TSRM.h https://huggingface.co/datasets/meddyrat/dis-bench/resolve/main/src/php/php-src/TSRM/TSRM.h
6.81 kB
| /* | |
| +----------------------------------------------------------------------+ | |
| | Thread Safe Resource Manager | | |
| +----------------------------------------------------------------------+ | |
| | Copyright (c) 1999-2011, Andi Gutmans, Sascha Schumann, Zeev Suraski | | |
| | This source file is subject to the TSRM license, that is bundled | | |
| | with this package in the file LICENSE | | |
| +----------------------------------------------------------------------+ | |
| | Authors: Zeev Suraski <zeev@php.net> | | |
| +----------------------------------------------------------------------+ | |
| */ | |
| typedef intptr_t tsrm_intptr_t; | |
| typedef uintptr_t tsrm_uintptr_t; | |
| /* Only compile multi-threading functions if we're in ZTS mode */ | |
| typedef int ts_rsrc_id; | |
| /* Define THREAD_T and MUTEX_T */ | |
| typedef void (*ts_allocate_ctor)(void *); | |
| typedef void (*ts_allocate_dtor)(void *); | |
| extern "C" { | |
| /* startup/shutdown */ | |
| TSRM_API bool tsrm_startup(int expected_threads, int expected_resources, int debug_level, const char *debug_filename); | |
| TSRM_API void tsrm_shutdown(void); | |
| /* environ lock API */ | |
| TSRM_API void tsrm_env_lock(void); | |
| TSRM_API void tsrm_env_unlock(void); | |
| /* allocates a new thread-safe-resource id */ | |
| TSRM_API ts_rsrc_id ts_allocate_id(ts_rsrc_id *rsrc_id, size_t size, ts_allocate_ctor ctor, ts_allocate_dtor dtor); | |
| /* Fast resource in reserved (pre-allocated) space */ | |
| TSRM_API void tsrm_reserve(size_t size); | |
| TSRM_API ts_rsrc_id ts_allocate_fast_id(ts_rsrc_id *rsrc_id, size_t *offset, size_t size, ts_allocate_ctor ctor, ts_allocate_dtor dtor); | |
| /* fetches the requested resource for the current thread */ | |
| TSRM_API void *ts_resource_ex(ts_rsrc_id id, THREAD_T *th_id); | |
| /* frees all resources allocated for the current thread */ | |
| TSRM_API void ts_free_thread(void); | |
| /* deallocates all occurrences of a given id */ | |
| TSRM_API void ts_free_id(ts_rsrc_id id); | |
| /* Runs a callback on all resources of the given id. | |
| * The caller is responsible for ensuring the underlying resources don't data-race. */ | |
| TSRM_API void ts_apply_for_id(ts_rsrc_id id, void (*cb)(void *)); | |
| /* Debug support */ | |
| typedef void (*tsrm_thread_begin_func_t)(THREAD_T thread_id); | |
| typedef void (*tsrm_thread_end_func_t)(THREAD_T thread_id); | |
| typedef void (*tsrm_shutdown_func_t)(void); | |
| TSRM_API int tsrm_error(int level, const char *format, ...); | |
| TSRM_API void tsrm_error_set(int level, const char *debug_filename); | |
| /* utility functions */ | |
| TSRM_API THREAD_T tsrm_thread_id(void); | |
| TSRM_API MUTEX_T tsrm_mutex_alloc(void); | |
| TSRM_API void tsrm_mutex_free(MUTEX_T mutexp); | |
| TSRM_API int tsrm_mutex_lock(MUTEX_T mutexp); | |
| TSRM_API int tsrm_mutex_unlock(MUTEX_T mutexp); | |
| TSRM_API int tsrm_sigmask(int how, const sigset_t *set, sigset_t *oldset); | |
| TSRM_API void *tsrm_set_new_thread_begin_handler(tsrm_thread_begin_func_t new_thread_begin_handler); | |
| TSRM_API void *tsrm_set_new_thread_end_handler(tsrm_thread_end_func_t new_thread_end_handler); | |
| TSRM_API void *tsrm_set_shutdown_handler(tsrm_shutdown_func_t shutdown_handler); | |
| TSRM_API void *tsrm_get_ls_cache(void); | |
| TSRM_API size_t tsrm_get_ls_cache_tcb_offset(void); | |
| TSRM_API bool tsrm_is_main_thread(void); | |
| TSRM_API bool tsrm_is_shutdown(void); | |
| TSRM_API const char *tsrm_api_name(void); | |
| TSRM_API bool tsrm_is_managed_thread(void); | |
| } | |