MCPcopy Create free account
hub / github.com/apache/httpd / ap_thread_current_create

Function ap_thread_current_create

server/util.c:3215–3254  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

3213#endif /* AP_HAS_THREAD_LOCAL */
3214
3215AP_DECLARE(apr_status_t) ap_thread_current_create(apr_thread_t **current,
3216 apr_threadattr_t *attr,
3217 apr_pool_t *pool)
3218{
3219 apr_status_t rv;
3220 apr_abortfunc_t abort_fn = apr_pool_abort_get(pool);
3221 apr_allocator_t *allocator;
3222 apr_os_thread_t osthd;
3223 apr_pool_t *p;
3224
3225 *current = ap_thread_current();
3226 if (*current) {
3227 return APR_EEXIST;
3228 }
3229
3230 rv = apr_allocator_create(&allocator);
3231 if (rv != APR_SUCCESS) {
3232 if (abort_fn)
3233 abort_fn(rv);
3234 return rv;
3235 }
3236 rv = apr_pool_create_unmanaged_ex(&p, abort_fn, allocator);
3237 if (rv != APR_SUCCESS) {
3238 apr_allocator_destroy(allocator);
3239 return rv;
3240 }
3241 apr_allocator_owner_set(allocator, p);
3242
3243 osthd = apr_os_thread_current();
3244 rv = apr_os_thread_put(current, &osthd, p);
3245 if (rv != APR_SUCCESS) {
3246 apr_pool_destroy(p);
3247 return rv;
3248 }
3249
3250#if AP_HAS_THREAD_LOCAL
3251 current_thread = *current;
3252#endif
3253 return APR_SUCCESS;
3254}
3255
3256AP_DECLARE(void) ap_thread_current_after_fork(void)
3257{

Callers 3

ap_thread_main_createFunction · 0.85
worker_mainFunction · 0.85
httpd.hFile · 0.85

Calls 1

ap_thread_currentFunction · 0.85

Tested by

no test coverage detected