Re: release not done right away
Re: release not done right away
- Subject: Re: release not done right away
- From: Nicolas Berloquin <email@hidden>
- Date: Wed, 21 Apr 2004 15:16:41 +0200
On 21 avr. 04, at 14:34, j o a r wrote:
>
>
On 2004-04-21, at 14.24, Nicolas Berloquin wrote:
>
>
> Are you talking about problems with synchronisation in the same way
>
> one would talk about separate threads ?
>
> Because if this is the case, I'm prepared to handle those type of
>
> problems.
>
>
No, I was referring to dealing with a chain of events that is spread
>
out over several event loops. If you get into a habit of doing this,
>
you will create code that is much, much, more difficult to debug. If
>
you get a crash you will not get a full backtrace explaining why some
>
method was called, because it was just called by a timer, and you will
>
not know where that timer was set. If you run everything in one event
>
loop you will see the full backtrace all the way back to the
>
originating event. Trust me, if you can do something in one event
>
loop, do that - even if you have to spend a bit more time thinking
>
about your design.
alright. actually, timers are inserted inside the current runloop, as
new input sources, so they don't really have a separate event loop.
and the doc says :
"When an NSRunLoop runs, it polls each of the sources for the input
mode to determine if any need processing. Only one is processed per
loop. "
So I consider them a bit like an event that gets sent to a specific
target/selector after a specified time.
When there is user input, the runloop handles it. When it's a timer I
set up for my network handling, that handling is done.
And all of this is one after the other. So I can't see where would be
the "several event loops".
I'm also using CFSockets that call my callbacks when data has arrived,
and that gets intertwined with the rest...
Please tell me where my reasoning is wrong.
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.