Revert "Delete platform preprocessing macros. Rewrite semaphores as named. Delete unnamed semaphore"

This reverts commit 48421b443a7f4bac77c246bade70da3131d6dc80.