I am currently creating a thin C ++ wrapper around pthreads for internal use. Windows and QNX are oriented, and fortunately, the pthreads-win32 ports work very well, and QNX is POSIX compliant for our practical purposes.
Now, executing the semaphores, I click on the function
sem_post_multiple(sem_t*, int)
which, apparently, is only available on pthreads-win32, but not in QNX. As the name implies, the function should increase the semaphore by the account specified as the second argument. As far as I can tell, the function is not part of either POSIX 1b or POSIX 1c.
Although there is currently no requirement for this function, I'm still wondering why pthreads-win32 provides this function and whether it can be useful. I could try to simulate it for QNX using something like the following:
sem_post_multiple_qnx(sem_t* sem, int count) { for(;count > 0; --count) { sem_post(sem); } }
What I am asking is a suggestion / advice on how to proceed. If consensus is to implement a function for QNX, I would also like to comment on whether the proposed code is shortened - this is a viable solution.
Thanks in advance.
PS: I specifically missed my C ++ class for clarity. For all people who suggest speeding up salvation: this is not an option in my current project due to managerial considerations.
source share