thread_init_and_detach shouldn't return thread since you can't access it anymore anyway

This commit is contained in:
Dennis Felsing 2023-06-14 13:19:36 +02:00
parent 7e82bf3a53
commit 021837fa60
2 changed files with 4 additions and 4 deletions

View file

@ -833,12 +833,12 @@ void thread_detach(void *thread)
#endif
}
void *thread_init_and_detach(void (*threadfunc)(void *), void *u, const char *name)
bool thread_init_and_detach(void (*threadfunc)(void *), void *u, const char *name)
{
void *thread = thread_init(threadfunc, u, name);
if(thread)
thread_detach(thread);
return thread;
return thread != nullptr;
}
#if defined(CONF_FAMILY_UNIX)

View file

@ -603,9 +603,9 @@ void thread_detach(void *thread);
* @param user Pointer to pass to the thread.
* @param name Name describing the use of the thread
*
* @return The thread if no error occurred, 0 on error.
* @return true on success, false on failure.
*/
void *thread_init_and_detach(void (*threadfunc)(void *), void *user, const char *name);
bool thread_init_and_detach(void (*threadfunc)(void *), void *user, const char *name);
// Enable thread safety attributes only with clang.
// The attributes can be safely erased when compiling with other compilers.