dragon.globalservices.api_setup
API for managing the life-cycle of objects, such as processes and channels, through Global Services
Functions
|
|
|
Posts a message to GS and gets the response in a thread safe way |
|
|
|
|
|
- gs_request(req_msg, *, expecting_response=True)[source]
Posts a message to GS and gets the response in a thread safe way
This is an attempt to make global services transactions blocking and thread safe while avoiding needless head of queue blocking - we don’t want there to be only one transaction outstanding at a time because it might take a long time to finish and block other threads’ transactions in the meantime, but without starting a separate dedicated thread simply to deal and service gs transactions. The implementation here tries to solve this without involving a new thread at all, but that might not be the best way to do it; a separate service thread would probably be simpler.
The overhead of doing this stuff if only one thread is ever involved means acquiring a couple locks that have no contention on them and constructing an event variable which means another lock.
- Arguments:
- param req_msg:
request message to send.
- param expecting_response:
Bool default True, is a response message expected?
- Returns:
the reply to the request message