Implement ThreadSem
merge
RPC broken, make AMF compile and run