os_sync.c: New source code that contains semaphore functions