_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
This commit is contained in:
vangyzen 2018-11-30 03:01:32 +00:00
parent e3e55bd3e4
commit abc905bddf
3 changed files with 3 additions and 8 deletions

View File

@ -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();

View File

@ -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

View File

@ -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;