Frank Fock
Frank.Fock____t-online.de
Tue Sep 12 10:22:48 CEST 2000
Hi David,
David Duville wrote:
> Hi,
>
> I'm new in using AGENT++ 3.4, I thought I read the documentation but one point is still not clear for me is the use of start_synch() .... end_synch() .
>
> I wanted to know how works the ThreadManager start_synch() method.
> Does it woks like in Java that is to say all resources accessed beetween start_synch() and end_synch() are locked and reserved by the Thread which is using them and these resouces are release after the bloc or does is works by doing a copy of the resouces what permit other Threads to process requests which came during the execution of the start_synch() .... end_synch() block.
>
It works like "synchronized (Object) { }" statement in Java. The Object
in AGENT++
is the object on whose behalf the start_synch() and end_synch() methods
are called.
>
> my question is because in my code while updating an EntryView in a
> table even if I use this block or not I have no error and everything
> seems to be OK
>
>
If you do not use the lock, you may get a segmentation violation
when two threads simultaneously update your table. This is relatively
unlikely but will happen sometime.
Best regards,
Frank
More information about the AGENTPP
mailing list