[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: Objects, processes, and encapsulation



Marcel Boosten wrote:
> The callback results in a cyclic call, which causes the problem.
> Note that in CSP, such cyclic calls would typically result in deadlock.
> 
>      A sends message to B, and waits for response.
>      B sends request to A.
>      Deadlock: A is waiting for the result, and cannot handle
>      the request sent by B.
> 
> Cyclic & Synchronous relationships are a problem: in CSP and in OO.
> 
> Should they be rulled out? If so, how? If not, how should they be dealt
> with?

The original process object could call a method and accept the callback
method in parallel, something like:

PAR
  callchannel.method(...)
  callbackchannel.accept()

+----+ callchannel  +----+
|    |------------->|    |
|    |<-------------|    |
+----+ callbackchan +----+

This eliminates the deadlock, but this may still results in the callback
problem.

Gerald.