svn commit: r341277 - head/lib/libthr/thread
Eric van Gyzen
vangyzen at FreeBSD.org
Fri Nov 30 03:02:23 UTC 2018
Author: vangyzen
Date: Fri Nov 30 03:01:32 2018
New Revision: 341277
URL: https://svnweb.freebsd.org/changeset/base/341277
Log:
_thr_setthreaded() cannot fail; change return type to void
Also remove logic to avoid unnecessary stores to the global variable.
Thread creation and destruction are heavy enough that any supposed savings
is in the noise.
MFC after: 2 weeks
Sponsored by: Dell EMC Isilon
Modified:
head/lib/libthr/thread/thr_create.c
head/lib/libthr/thread/thr_kern.c
head/lib/libthr/thread/thr_private.h
Modified: head/lib/libthr/thread/thr_create.c
==============================================================================
--- head/lib/libthr/thread/thr_create.c Fri Nov 30 02:14:41 2018 (r341276)
+++ head/lib/libthr/thread/thr_create.c Fri Nov 30 03:01:32 2018 (r341277)
@@ -73,8 +73,7 @@ _pthread_create(pthread_t * __restrict thread,
*/
if (_thr_isthreaded() == 0) {
_malloc_first_thread();
- if (_thr_setthreaded(1))
- return (EAGAIN);
+ _thr_setthreaded(1);
}
curthread = _get_curthread();
Modified: head/lib/libthr/thread/thr_kern.c
==============================================================================
--- head/lib/libthr/thread/thr_kern.c Fri Nov 30 02:14:41 2018 (r341276)
+++ head/lib/libthr/thread/thr_kern.c Fri Nov 30 03:01:32 2018 (r341277)
@@ -53,14 +53,10 @@ static struct wake_addr default_wake_addr;
* This is called when the first thread (other than the initial
* thread) is created.
*/
-int
+void
_thr_setthreaded(int threaded)
{
- if (((threaded == 0) ^ (__isthreaded == 0)) == 0)
- return (0);
-
__isthreaded = threaded;
- return (0);
}
void
Modified: head/lib/libthr/thread/thr_private.h
==============================================================================
--- head/lib/libthr/thread/thr_private.h Fri Nov 30 02:14:41 2018 (r341276)
+++ head/lib/libthr/thread/thr_private.h Fri Nov 30 03:01:32 2018 (r341277)
@@ -776,7 +776,7 @@ extern struct pthread *_single_thread __hidden;
* Function prototype definitions.
*/
__BEGIN_DECLS
-int _thr_setthreaded(int) __hidden;
+void _thr_setthreaded(int) __hidden;
int _mutex_cv_lock(struct pthread_mutex *, int, bool) __hidden;
int _mutex_cv_unlock(struct pthread_mutex *, int *, int *) __hidden;
int _mutex_cv_attach(struct pthread_mutex *, int) __hidden;
More information about the svn-src-head
mailing list