p2psim loctable
p2psim loctable is the location table storing routing information, for chord finger protocol, it stores the address info for 2^{i} long-range links, refer to ChordFinger::initstate()
p2psim is actually single threaded -- you almost never have to worry
about locking. There is only ever one thread running at a time. The
only time you have to worry is the persistance of variable state across
a doRPC call. When you do a synchronous RPC, p2psim will probably allow
other threads to run, and it's possible those threads can change shared
state such that when the RPC finishes and control returns, you might
have unexpected consequences (e.g., the node has died in the meantime).
So just be careful that when you come back from an RPC, you check for
any assumptions that may have been violated.
ConditionVar is a method for threads to sleep until some specific event
happens in another thread. For example, in Tapestry, we use it to pause
events that arrive while the node is in an unjoined state. When the
join completes, those events are notified via the ConditionVar, and they
continue to be processed. It is not too useful for synchronization, but
again, there is no need for synchronization in p2psim anyway.
Linux supports the following synchronization mechanisms: