• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Can't modify EO objects! ARGH! =(
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Can't modify EO objects! ARGH! =(


  • Subject: Re: Can't modify EO objects! ARGH! =(
  • From: Chuck Hill <email@hidden>
  • Date: Tue, 22 Jul 2003 10:03:11 -0700

At 09:26 PM 21/07/2003 -1000, Art Isbell wrote:
>
>	If I read the WO 5.2 documentation correctly, a nested editing context
>uses the lock of its parent, so if its parent is the session's default
>editing context, there's no need to lock it.
>
No, that is a documentation defect.  I think it is supposed to read, "A
nested editing context uses the *same NSRecursiveLock instance* as its
parent".  However, this code

parentsLock.lock();

Is *not* equivalent to
public void lock() {
    // Do some stuff
    parentsLock.lock();
    // Do some other stuff
}

Assuming that the lock() method does nothing other than call lock() on the
parent's lock is dangerous and, my experiments suggest, very incorrect.

The undocumented reverse is in fact true: locking the child *does* lock the
parent.


>	Locking does impose a small performance penalty and can lead to
>deadlocks if not done correctly.
>
And not locking can lead to unpredictable disaster.  :-)


>> Concurrent request handling is a WOF feature.
>
>	True, but unless the programmer creates new threads herself,
>concurrent request handling will be the source of the multiple threads
>that an editing context might need to deal with.
>
Yes, we if choose to ignore the existence of WOLongResponsePage, session
terminator thread, finalizer thread...
java != SingleThreaded


>So in the usual
>situation without concurrent request handling (i.e., no
>programmer-created threads), is there any exposure of an editing
>context to multiple threads?


Yes!  Proper locking or Russian Roulette, the choice is yours!



Chuck


--

Chuck Hill                                 email@hidden
Global Village Consulting Inc.             http://www.global-village.net
_______________________________________________
webobjects-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/webobjects-dev
Do not post admin requests to the list. They will be ignored.

References: 
 >Re: Can't modify EO objects! ARGH! =( (From: Giorgio Valoti <email@hidden>)
 >Re: Can't modify EO objects! ARGH! =( (From: Art Isbell <email@hidden>)

  • Prev by Date: Local ECs (was Re: Can't modify EO objects! ARGH! =()
  • Next by Date: Re: Can't modify EO objects! ARGH! =(
  • Previous by thread: Local ECs (was Re: Can't modify EO objects! ARGH! =()
  • Next by thread: Local ECs (was Re: Can't modify EO objects! ARGH! =()
  • Index(es):
    • Date
    • Thread