3 ms·
GNU make runs on a lot of different systems. There is not a semaphore API shared between them, but there will (almost certainly) be a usable pipe() on all of th
by jws 7y ago
GNU make runs on a lot of different systems. There is not a semaphore API shared between them, but there will (almost certainly) be a usable pipe() on all of them.
But… if I could, I would probably use POSIX semaphores, no wait SYS-V, no, hang on, let me read some web pages… um… let me check my repositories and see which I've used before… both… hmm…
Seriously, I can't see getting so frustrated choosing that I'd just go with pipe(), but there is room for improvement in portable semaphore APIs.
- zvrba 7y agoI tried quickly to find the list of supported systems, but the main documentation pages don't mention them. That said, pipe() is not "portable" either, so whether to use platform-dependent code for pipes or semaphores... no big difference. > Seriously, I can't see getting so frustrated If reading documentation and evaluating options frustrates you, you shouldn't be dealing with software development.
- temac 7y ago> That said, pipe() is not "portable" either, so whether to use platform-dependent code for pipes or semaphores... no big difference. pipe() is in POSIX base since forever. If it is not portable, I don't know what is. Oh well C is more portable than POSIX, ok; but C does not do IPC at all (actually not even processes) so that's irrelevant. SysV semaphores are in XSI, POSIX semaphore are only in base since recently, previously they were in a Semaphore option. So yes, pipe() is absolutely more portable. Works on all BSDs, GNU/Linux, embedded Linuxes, Solaris, dead Unixes, Android, QNX, Cygwin (where on the other hand semget seems buggy: https://cygwin.com/ml/cygwin/2019-08/msg00099.html https://cygwin.com/ml/cygwin/2019-08/msg00099.html), Mac Os, etc.
- JdeBP 7y agoExcept that now, thanks to the GNU make change in 2017, there are two families of jobserver where previously there was one. There is a family that sets the pipe file descriptors to non-blocking mode, and there is a family that sets the pipe file descriptors to blocking mode. Alas, the twain do not mix. So anything that wants to interoperate has to know what family of jobserver it is interoperating with. (It has been well known in the Unix world for years that if all programs do not agree on whether a shared file descriptor is in non-blocking mode, difficulties ensue. Yes, nonblock_read() and nonblock_write() would have provided a way to solve this whilst retaining interoperability.) * https://jdebp.eu/FGA/dont-set-shared-file-descriptors-to-non-blocking-mode.html https://jdebp.eu/FGA/dont-set-shared-file-descriptors-to-non...
- ChickeNES 7y ago> Oh well C is more portable than POSIX, ok; but C does not do IPC at all (actually not even processes) so that's irrelevant. C11 adds threads and mutexes