multi thread refactoring:
- mutex moved to platform
- created other sync primitives (semaphore, event, spin mutex)
- created version for OSX
- task re-factored