Threading with SharedObjects

View: New views
2 Messages — Rating Filter:   Alert me  

Parent Message unknown Threading with SharedObjects

by Chris Cowherd :: Rate this Message:

Reply (Restricted by the Administrator) | Reply to Author | View Threaded | Show Only this Message

Some parts of this message have been removed. Learn more about Nabble's security policy.
Is it safe to use SharedObjects from multiple threads?  I don't see any synchronization inside of SharedObject.

Isn't it possible two worker threads will attempt to update it and mess it up?

For instance I get InvalidOperation exceptions (_listeners hashtable has been modified) inside of SendUpdates() quite frequently because of subscribers coming and going.

I've tried wrapping my code that accesses SharedObjects in synchronization primitives but I still get the exceptions so I was wondering if it was happening internally.


Test your Star IQ Play now!
_______________________________________________
fluorine mailing list
fluorine@...
http://fluorine.thesilentgroup.com/mailman/listinfo/fluorine_fluorine.thesilentgroup.com

Re: Threading with SharedObjects

by Support-179 :: Rate this Message:

Reply (Restricted by the Administrator) | Reply to Author | View Threaded | Show Only this Message

Some parts of this message have been removed. Learn more about Nabble's security policy.
Hi Chris,
 
you are correct, the Hashtable member is not appropriate as it was not synchronized. Actually since then the listeners member was changed to a CopyOnWriteArray type so the enumerators will not get messed up.
I will merge some of the changes into the source code then will let you know when you can download it
 
Zoli

 

From: fluorine-bounces@... [mailto:fluorine-bounces@...] On Behalf Of Chris Cowherd
Sent: Friday, March 21, 2008 2:39 AM
To: fluorine@...
Subject: [Fluorine] Threading with SharedObjects

Is it safe to use SharedObjects from multiple threads?  I don't see any synchronization inside of SharedObject.

Isn't it possible two worker threads will attempt to update it and mess it up?

For instance I get InvalidOperation exceptions (_listeners hashtable has been modified) inside of SendUpdates() quite frequently because of subscribers coming and going.

I've tried wrapping my code that accesses SharedObjects in synchronization primitives but I still get the exceptions so I was wondering if it was happening internally.


Test your Star IQ Play now!
_______________________________________________
fluorine mailing list
fluorine@...
http://fluorine.thesilentgroup.com/mailman/listinfo/fluorine_fluorine.thesilentgroup.com