ns_sema release semaid ?count?
ns_sema create initializes a semaphore and returns an ID for it. If the count argument is specified, the semaphore is initialized with that count. The default for count is 0.
ns_sema destroy frees the resources associated with the specified semaphore. The semaid argument is the ID returned by ns_sema create when the semaphore was created.
ns_sema release increments the count of the specified semaphore. By default, the semaphore is incremented 1 (one) time. If the count argument is specified, the semaphore is incremented count times. The semaid argument is the ID returned by ns_sema create when the semaphore was created.
ns_sema wait waits for the count of the specified semaphore to be greater than 0 (zero). If it is greater than 0, the count is decremented and processing continues. If it is not greater than 0, it is blocked until this is possible. The semaid argument is the ID returned by ns_sema create when the semaphore was created.