The windows version of the semaphore (jsem.hpp) may need to change to add protection for n == 0

    void signal(unsigned count)
    {
        if (count)
            ReleaseSemaphore(hSem,count,NULL);
    }

since the documentation claims it should be > 0