Changeset View
Changeset View
Standalone View
Standalone View
lib/libthr/thread/thr_pshared.c
Show First 20 Lines • Show All 207 Lines • ▼ Show 20 Lines | |||||
pshared_clean(void *key, void *val) | pshared_clean(void *key, void *val) | ||||
{ | { | ||||
if (val != NULL) | if (val != NULL) | ||||
munmap(val, page_size); | munmap(val, page_size); | ||||
_umtx_op(NULL, UMTX_OP_SHM, UMTX_SHM_DESTROY, key, NULL); | _umtx_op(NULL, UMTX_OP_SHM, UMTX_SHM_DESTROY, key, NULL); | ||||
} | } | ||||
static void | |||||
pshared_destroy(struct pthread *curthread, void *key) | |||||
{ | |||||
void *val; | |||||
pshared_wlock(curthread); | |||||
val = pshared_remove(key); | |||||
pshared_unlock(curthread); | |||||
pshared_clean(key, val); | |||||
} | |||||
void * | void * | ||||
__thr_pshared_offpage(void *key, int doalloc) | __thr_pshared_offpage(void *key, int doalloc) | ||||
{ | { | ||||
struct pthread *curthread; | struct pthread *curthread; | ||||
void *res; | void *res; | ||||
int fd, ins_done; | int fd, ins_done; | ||||
curthread = _get_curthread(); | curthread = _get_curthread(); | ||||
Show All 19 Lines | __thr_pshared_offpage(void *key, int doalloc) | ||||
} | } | ||||
return (res); | return (res); | ||||
} | } | ||||
void | void | ||||
__thr_pshared_destroy(void *key) | __thr_pshared_destroy(void *key) | ||||
{ | { | ||||
struct pthread *curthread; | struct pthread *curthread; | ||||
void *val; | |||||
curthread = _get_curthread(); | curthread = _get_curthread(); | ||||
pshared_wlock(curthread); | pshared_destroy(curthread, key); | ||||
val = pshared_remove(key); | |||||
pshared_unlock(curthread); | |||||
pshared_clean(key, val); | |||||
pshared_gc(curthread); | pshared_gc(curthread); | ||||
} | } | ||||
void | void | ||||
__thr_pshared_atfork_pre(void) | __thr_pshared_atfork_pre(void) | ||||
{ | { | ||||
_thr_rwl_rdlock(&pshared_lock); | _thr_rwl_rdlock(&pshared_lock); | ||||
} | } | ||||
void | void | ||||
__thr_pshared_atfork_post(void) | __thr_pshared_atfork_post(void) | ||||
{ | { | ||||
_thr_rwl_unlock(&pshared_lock); | _thr_rwl_unlock(&pshared_lock); | ||||
} | } |