Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F177539129
D60717.1794664435.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Flag For Later
Award Token
Authored By
Unknown
Size
1 KB
Referenced Files
None
Subscribers
None
D60717.1794664435.diff
View Options
diff --git a/lib/libthr/thread/thr_join.c b/lib/libthr/thread/thr_join.c
--- a/lib/libthr/thread/thr_join.c
+++ b/lib/libthr/thread/thr_join.c
@@ -92,19 +92,12 @@
return (join_common(pthread, thread_return, NULL, false, true));
}
-static void
-join_common_joined(struct pthread *pthread, struct pthread *curthread,
- void **thread_return)
+static void *
+join_common_detach(struct pthread *pthread)
{
- void *tmp;
-
- tmp = pthread->ret;
pthread->flags |= THR_FLAGS_DETACHED;
pthread->joiner = NULL;
- _thr_try_gc(curthread, pthread); /* thread lock released */
-
- if (thread_return != NULL)
- *thread_return = tmp;
+ return (pthread->ret);
}
/*
@@ -117,6 +110,7 @@
{
struct pthread *curthread = _get_curthread();
struct timespec ts, ts2, *tsp;
+ void *tmp;
long tid;
int ret;
@@ -156,7 +150,10 @@
THR_THREAD_UNLOCK(curthread, pthread);
return (EBUSY);
}
- join_common_joined(pthread, curthread, thread_return);
+ tmp = join_common_detach(pthread);
+ _thr_try_gc(curthread, pthread); /* thread lock released */
+ if (thread_return != NULL)
+ *thread_return = tmp;
return (0);
}
@@ -193,8 +190,17 @@
backout_join(pthread, curthread);
} else {
ret = 0;
+ THREAD_LIST_WRLOCK(curthread);
THR_THREAD_LOCK(curthread, pthread);
- join_common_joined(pthread, curthread, thread_return);
+ tmp = join_common_detach(pthread);
+ if (THR_SHOULD_GC(pthread)) {
+ THR_LIST_REMOVE(pthread);
+ THR_GCLIST_ADD(pthread);
+ }
+ THR_THREAD_UNLOCK(curthread, pthread);
+ THREAD_LIST_UNLOCK(curthread);
+ if (thread_return != NULL)
+ *thread_return = tmp;
}
return (ret);
}
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sat, Nov 14, 1:53 PM (8 h, 36 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
41028081
Default Alt Text
D60717.1794664435.diff (1 KB)
Attached To
Mode
D60717: libthr: drop use of try_gc in the end of thr_join
Attached
Detach File
Event Timeline