199 vrpn_PeerMutex(
const char *name,
int port,
const char *NICaddress = NULL);
234 vrpn_bool
addPeer(
const char *stationName);
292 vrpn_uint32 PortNumber);
294 vrpn_uint32 PortNumber);
303 void init(
const char *name);
Generic connection class not specific to the transport mechanism.
void triggerTakeCallbacks(void)
static int VRPN_CALLBACK handle_grantRequest(void *, vrpn_HANDLERPARAM)
static int VRPN_CALLBACK handle_initialize(void *, vrpn_HANDLERPARAM)
vrpn_bool d_requestBeforeInit
vrpn_bool addTakeCallback(void *userdata, int(*)(void *))
These callbacks are triggered when ANY peer gets the mutex.
static int VRPN_CALLBACK handle_denyRequest(void *, vrpn_HANDLERPARAM)
vrpn_bool addRequestGrantedCallback(void *userdata, int(*)(void *))
These callbacks are triggered when OUR request is granted.
vrpn_bool isAvailable(void) const
True from when release() is called or we receive a release message from another process until request...
mutexCallback * d_reqGrantedCB
void triggerReleaseCallbacks(void)
mutexCallback * d_reqDeniedCB
void triggerDenyCallbacks(void)
mutexCallback * d_releaseCB
vrpn_bool isHeldLocally(void) const
True from when RequestGranted callbacks are triggered until release() is called.
void triggerGrantCallbacks(void)
void request(void)
Request the distributed lock. Does not request the lock if !isAvailable(), instead automatically trig...
static int VRPN_CALLBACK handle_releaseNotification(void *, vrpn_HANDLERPARAM)
static int VRPN_CALLBACK handle_gotConnection(void *, vrpn_HANDLERPARAM)
vrpn_bool addReleaseCallback(void *userdata, int(*)(void *))
These callbacks are triggered when ANY peer releases the mutex.
vrpn_bool addRequestDeniedCallback(void *userdata, int(*)(void *))
These callbacks are triggered when OUR request is denied.
vrpn_bool isHeldRemotely(void) const
True from when we grant the lock to another process in response to its request message until we recei...
vrpn_Mutex_Remote(const char *name, vrpn_Connection *=NULL)
void release(void)
Release the distributed lock. Does nothing if !isHeldLocally() and there isn't a request pending.
static int VRPN_CALLBACK handle_requestMutex(void *, vrpn_HANDLERPARAM)
static int VRPN_CALLBACK handle_release(void *, vrpn_HANDLERPARAM)
static int VRPN_CALLBACK handle_gotConnection(void *, vrpn_HANDLERPARAM)
vrpn_int32 d_remoteIndex
Counts remotes who have had IDs issued to them.
static int VRPN_CALLBACK handle_requestIndex(void *, vrpn_HANDLERPARAM)
vrpn_Mutex_Server(const char *name, vrpn_Connection *=NULL)
static int VRPN_CALLBACK handle_dropLastConnection(void *, vrpn_HANDLERPARAM)
vrpn_int32 d_requestMutex_type
vrpn_Connection * d_connection
vrpn_int32 d_release_type
vrpn_int32 d_initialize_type
vrpn_int32 d_requestIndex_type
void sendDenyRequest(vrpn_int32 index)
vrpn_int32 d_denyRequest_type
vrpn_Mutex(const char *name, vrpn_Connection *=NULL)
void sendRequest(vrpn_int32 index)
void sendReleaseNotification(void)
void sendGrantRequest(vrpn_int32 index)
vrpn_int32 d_grantRequest_type
vrpn_int32 d_releaseNotification_type
vrpn_Connection * d_server
Receive on this connection.
int d_numPeersGrantingLock
Counts the number of "grants" we've received after issuing a request; when this reaches d_numPeers,...
mutexCallback * d_releaseCB
void triggerTakeCallbacks(void)
void triggerReleaseCallbacks(void)
static int VRPN_CALLBACK handle_losePeer(void *, vrpn_HANDLERPARAM)
void init(const char *name)
vrpn_bool addRequestGrantedCallback(void *userdata, int(*)(void *))
These callbacks are triggered when OUR request is granted.
vrpn_bool addRequestDeniedCallback(void *userdata, int(*)(void *))
These callbacks are triggered when OUR request is denied.
vrpn_bool addPeer(const char *stationName)
Takes a VRPN station name of the form "<host>:<port>".
static int VRPN_CALLBACK handle_denyRequest(void *, vrpn_HANDLERPARAM)
peerData * d_peerData
Needed only to clean up when a peer shuts down (mid-request). It isn't currently feasible to have all...
vrpn_Connection ** d_peer
Send on these connections to other Mutex's well-known-ports.
vrpn_bool addReleaseCallback(void *userdata, int(*)(void *))
These callbacks are triggered when ANY peer releases the mutex.
void triggerDenyCallbacks(void)
void release(void)
Release the distributed lock. Does nothing if !isHeldLocally() and there isn't a request pending.
static int VRPN_CALLBACK handle_release(void *, vrpn_HANDLERPARAM)
vrpn_bool isHeldLocally(void) const
True from when RequestGranted callbacks are triggered until release() is called.
void sendGrantRequest(vrpn_Connection *, vrpn_uint32 IPnumber, vrpn_uint32 PortNumber)
void triggerGrantCallbacks(void)
static int VRPN_CALLBACK handle_request(void *, vrpn_HANDLERPARAM)
mutexCallback * d_reqDeniedCB
vrpn_int32 d_release_type
vrpn_bool isHeldRemotely(void) const
True from when we grant the lock to another process in response to its request message until we recei...
vrpn_int32 d_denyRequest_type
void sendRequest(vrpn_Connection *)
vrpn_bool isAvailable(void) const
True from when release() is called or we receive a release message from another process until request...
vrpn_int32 d_grantRequest_type
void sendDenyRequest(vrpn_Connection *, vrpn_uint32 IPnumber, vrpn_uint32 PortNumber)
void sendRelease(vrpn_Connection *)
vrpn_PeerMutex(const char *name, int port, const char *NICaddress=NULL)
This constructor opens a new connection/port for the mutex.
static int VRPN_CALLBACK handle_grantRequest(void *, vrpn_HANDLERPARAM)
void checkGrantMutex(void)
void request(void)
Request the distributed lock. Does not request the lock if !isAvailable(), instead automatically trig...
int d_numConnectionsAllocated
Dynamic array size for d_peer and d_peerGrantedLock.
vrpn_int32 d_request_type
vrpn_bool addTakeCallback(void *userdata, int(*)(void *))
These callbacks are triggered when ANY peer gets the mutex. (If several peers are competing for the m...
mutexCallback * d_reqGrantedCB
This structure is what is passed to a vrpn_Connection message callback.
class VRPN_API vrpn_Connection