Move lock, getref() needs a writelock internally
Fix ws_object_getref() to check whether the lock could be aquired