Sun 25 Sep 2011 06:13:20 PM UTC, original submission:
Hi,
I'm facing some thread-safety issues in my libpipeline-based project[1], which I think are related to libpipeline. It looks like pipeline.c uses static variables and messes with the process signal mask. It might be possible to use pthread_sigmask and make those static variables thread-local.
At least pipeline_wait_all and the signal handlers should be made thread-safe. If the setting up of the pipeline would remain thread-unsafe, it wouldn't be a big deal.
So, what do you think? Is there a workaround you can think of? Is it always necessary to handle SIGCHLD? As far as I know, if you ignore SIGCHLD, your children won't become zombies anymore in Linux/BSD.
In synconv, we use libpipeline to create the transcoding pipeline (say, decoding with flac and encoding with lame). So we launch N different threads for each of the files that need to be transcoded. The threads block on pipeline_wait. If I use more than a single thread, I occasionally get an error message such as:
synconv: waitpid failed: No child processes
If you think going with TLS and maybe a lock or two isn't the way to go, I think I'll have to fork into another process to use libpipeline.
Thanks,
[1]: https://github.com/fernandotcl/synconv
|