Why do we need pthread_join?
In simple words pthread_join makes the calling thread wait till the newly created thread returns.
In simple words pthread_join makes the calling thread wait till the newly created thread returns.
Thread-safety of a function refers to the fact whether a function can be safely called from multiple threads simultaneously. Safety here means that even if multiple threads are executing the function simultaneously the data integrity is intact and is not intermingled.