J'ai une situation comme suit:Est-il bon de commencer un processus enfant à partir d'un fil de processus principal
main()
{
create a thread executing function thread_func();
another_func();
}
another_func()
{
//check something and do something.
// To do something, create a child process.
// after creating child process, current thread goes in checking state again
// child process independently running.
}
thread_func()
{
infinite loop(); // checking something and doing something
}
fil
est créé à l'aide pthread. Veuillez dire: est-il bon de lancer un processus fils comme ci-dessus dans un fil? Aussi ce qui se passe si cela est fait.
Est-ce que le processus enfant crée son propre thread de copie exécutant thread_func()?
Merci
Vous pourriez être intéressé par la lecture de [Que deviennent les autres threads quand un thread forks()?] (Https://stackoverflow.com/questions/10080811/what-happens-to-other-threads-when-one- thread-forks) –
Ce lien pourrait également être utile. https://stackoverflow.com/questions/39890363/what-happens-when-a-thread-forks –