On Oct 28, 2008, at 5:51 PM, Andrew Lindesay wrote:

Hello Chuck;

Define safe. ec.lock() does not lock the root object store, so other ec's can also set / clear foobar while you are in this code.

Thanks; I take back what I said to Peter just then!

Safe... I guess I mean no bad concurrent things happening to the OSC. I guess this is going to get a bit mucky. I guess the following would work because the locks in the object stores are re- entrant locks as far as I can remember...

Yes, that should be OK. It will block all other EOF operations that need the OSC.

Chuck







 ec.lock();

 try
 {
   EOObjectStore ros = ec. rootObjectStore();

   ros.lock();

   try
   {
     ros.setUserInfoForKey(xyz,"foobar");

     try
     {
        // do some editing context foo here!
     }
finally { ec.rootObjectStore().setUserInfoForKey(null,"foobar"); }
   }
   finally { ros.unlock(); }
 }
 finally { ec.unlock(); }

cheers.

___
Andrew Lindesay
www.lindesay.co.nz



--
Chuck Hill             Senior Consultant / VP Development

Practical WebObjects - for developers who want to increase their overall knowledge of WebObjects or who are trying to solve specific problems.
http://www.global-village.net/products/practical_webobjects






_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list      ([email protected])
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]

Reply via email to