In the case of semaphores and mutexes, we use Pthread_join to synchronize threads again before the program is launched.
If you want the thread that threads wants to create it to return data I need to do this;
Problem: Sometimes we don't need a second thread to return information to the main thread, and we don't want the main thread to wait for it to end;
This means that when the main thread is working, the second thread is created, and the second thread is working to the end without having to write new information to the main thread;
================
Detach Thread, detaced thread
Modify the thread properties or call the Pthread_detach method to resolve
======
#include <pthread.h>
int Pthread_attr_init (pthread_attr_t *attr);
int Pthread_attr_destroy ()
int pthread_attr_setdetachstate (pthread_attr_t *attr,int detachstate);
int pthread_attr_getdatachstate (const pthread_attr_t *attr,int *detachstate);
int Pthread_attr_setschedpolicy (pthread_attr_t *attr, int policy);
int Pthread_attr_getschedpolicy (const pthread_attr_t *attr,int *policy)
int Pthread_attr_setschedparam
int Pthread_attr_getschedparam
int pthread_attr_setinheritsched
int pthread_attr_getinheritsched
int Pthread_attr_setscope (
int Pthread_attr_getscope
int Pthread_attr_setstacksize
int Pthread_attr_getstacksize
Detachedstate: Property runs we don't need to re-merge threads, like most _set, a property pointer and a flag as parameters to determine the desired state
The two flags that may be used by the Set function are pthread_create_joinable (the default flag value), pthread_create_detached (if you choose this, you cannot use Pthread_join to get the exit status of another thread)
Shedpolicy controls how threads are dispatched,
Sched_other,sched_rp,sched_fifo
, &N Bsp , &NB Sp , &NB Sp , &NB Sp , &NB Sp , &NB Sp , &NB Sp &NBSP; , &NB Sp , &NB Sp , &NB Sp , &NB Sp , &NB Sp , &NB Sp , &NB Sp &NBSP , &NB Sp , &NB Sp , &NB Sp , &NB Sp , &NB Sp , &NB Sp , &NB Sp '
[Linux Basic foundation]----Thread's properties