Basically, as this is one application, one process, you can use the most light weight form of mutual exclusion
: critical section object:
For some background, please see also: http://en.wikipedia.org/wiki/Mutual_exclusion
However, as the question is very vague, this cannot be
a final answer, this is what most likely will work for you in most cases. You should always remember that best synchronization is no synchronization
. There are many scenarios when synchronization is not needed. For example, when your read or write operations go through some messaging mechanism, they are already serialized. But when you apply the read results to some shared object which affect your application state, you need to perform mutual exclusion on the code which performs the update and acquisition of this state. Further analysis would require further detail.