Fix ThreadService locking