ofxJSONRPC how to lock variables set in jsonrpc methods from the main thread?

I have an application that crashes, allthough rarely. ofxJSONRPC metod sets a boolean flag while update() reads it, that I guess cause access violations. With ofThread I can lock my way out of similar, but what would I do in this case? I need to lock ofxJSONRPC thread, when either itself or main thread access variables. Is there a simple trick or a suggestion to architect my way out of it?