summaryrefslogtreecommitdiff
path: root/lib/libthr/thread
diff options
context:
space:
mode:
authorKonstantin Belousov <kib@FreeBSD.org>2023-02-01 20:12:45 +0000
committerKonstantin Belousov <kib@FreeBSD.org>2023-02-08 00:26:59 +0000
commitc8452bdeed4fc1f1feadf36c6008367263292254 (patch)
tree7bb2ee66d6df396c971579b01598abca25c37c23 /lib/libthr/thread
parent06e6efccbfab46410ff7b9e034353453ea19ac3d (diff)
Diffstat (limited to 'lib/libthr/thread')
-rw-r--r--lib/libthr/thread/thr_pshared.c15
1 files changed, 10 insertions, 5 deletions
diff --git a/lib/libthr/thread/thr_pshared.c b/lib/libthr/thread/thr_pshared.c
index 37b44ab73582..446e9983bcae 100644
--- a/lib/libthr/thread/thr_pshared.c
+++ b/lib/libthr/thread/thr_pshared.c
@@ -232,11 +232,16 @@ __thr_pshared_offpage(void *key, int doalloc)
int fd, ins_done;
curthread = _get_curthread();
- pshared_rlock(curthread);
- res = pshared_lookup(key);
- pshared_unlock(curthread);
- if (res != NULL)
- return (res);
+ if (doalloc) {
+ pshared_destroy(curthread, key);
+ res = NULL;
+ } else {
+ pshared_rlock(curthread);
+ res = pshared_lookup(key);
+ pshared_unlock(curthread);
+ if (res != NULL)
+ return (res);
+ }
fd = _umtx_op(NULL, UMTX_OP_SHM, doalloc ? UMTX_SHM_CREAT :
UMTX_SHM_LOOKUP, key, NULL);
if (fd == -1)