Improved thread detection.
Fixed SysV semaphore.
Documentation and private member renaming.