sem_getvalue() places the current value of the semaphore pointed to sem into the integer pointed to by sval.
If one or more processes or threads are blocked waiting to lock the semaphore with sem_wait(3), POSIX.1-2001 permits two possibili‐
ties for the value returned in sval: either 0 is returned; or a negative number whose absolute value is the count of the number of
processes and threads currently blocked in sem_wait(3). Linux adopts the former behavior.
这是 Linux 的,windows 不知道