Bidirectional callbacks and mutexes

albertodsalbertods Member Alberto Della SantinaOrganization: University of Pisa - department of IT EngineeringProject: Mobile remote controller ✭✭
Dear ZeroC staff,
I have a question regarding the example that show the use of bidirectional connections for callbacks.

Why do you use the mutex? What does it protect?
Does this mutex protect the queue of clients that asks for this service or just the working thread?

In this demo, is the server able to serve multiple clients at the same time?


Thanks a lot

With my very best regards


Alberto

Comments

  • mesmes CaliforniaAdministrators, ZeroC Staff Mark SpruiellOrganization: ZeroC, Inc.Project: Ice Developer ZeroC Staff
    Hi,
    albertods wrote:
    Does this mutex protect the queue of clients that asks for this service or just the working thread?
    The mutex is used simply to protect the client list.
    In this demo, is the server able to serve multiple clients at the same time?
    Yes, it can handle multiple clients. The way it's written, however, a call to addClient would block until the callback thread finishes its invocations.

    Normally we recommend that you avoid holding locks while making remote invocations because of the risk of blocking and deadlocks (see Bernard's two-part series of newsletter articles starting in issue 4 for more information).

    Hope that helps,
    - Mark
Sign In or Register to comment.