Fixed semaphore up processing, added initial version of rw semaphore processing