RE: Channels versus Methods

From: P.H.Welch (P.H.Welch_at_email.domain.hidden)
Date: 1999-07-08 19:08:28


Amazing that however many times you read something through before posting,
you always find a silly immediately afterwards ...

> Or we can simply lock the CALL sequence using the channel object (which
> can therefor remain just 1-1):
>
>
> synchronise (c) {
> c.write (null); // ready to make the CALL
> Thing result = B.calculate (...); // or some other Foo method
> c.write (null); // the CALL is complete
> }

That's silly because locking on the channel itself will screw up the internal
algorithms that implement it! I just grabbed the channel for convenience.
A new one should have been used:

    Object c.lock = new Object ();

and then:

> synchronise (c.lock) {
> c.write (null); // ready to make the CALL
> Thing result = B.calculate (...); // or some other Foo method
> c.write (null); // the CALL is complete
> }

This was done correctly later in the posting (see One2ManyCallChannel).

Cheers,

Peter.


Original text of this message

This archive was generated by hypermail 2.1.7 on 2004-10-31 20:03:58 GMT
© Copyright WoTUG
All rights reserved