first libpthread draft, implement semaphore and spinlock