FROM : Jean-Daniel Dupas
DATE : Fri Aug 01 15:00:12 2008
Le 1 août 08 à 14:52, Ken Thomases a écrit :
> On Aug 1, 2008, at 6:43 AM, Chris Idou wrote:
>
>> I have a Cocoa thread waiting on events in a run loop. But I want
>> to be able to give the waiting thread a "kick" to make it wake up
>> and re-load its context.
>>
>> I realise I could write my own custom run loop input source, but it
>> seems like overkill if I could install a simple run loop observer
>> and somehow just wake it up when I want it to re-initialize. Is
>> there a way to do that?
>
> You don't have to write a custom run-loop source. Just add an
> NSPort instance as a source and message it for the "kick".
>
> Cheers,
> Ken
Yes, and on 10.5, you can also use the method - [NSObject
performSelector:onThread:withObject:waitUntilDone:], that will wake up
the target thread runloop.
DATE : Fri Aug 01 15:00:12 2008
Le 1 août 08 à 14:52, Ken Thomases a écrit :
> On Aug 1, 2008, at 6:43 AM, Chris Idou wrote:
>
>> I have a Cocoa thread waiting on events in a run loop. But I want
>> to be able to give the waiting thread a "kick" to make it wake up
>> and re-load its context.
>>
>> I realise I could write my own custom run loop input source, but it
>> seems like overkill if I could install a simple run loop observer
>> and somehow just wake it up when I want it to re-initialize. Is
>> there a way to do that?
>
> You don't have to write a custom run-loop source. Just add an
> NSPort instance as a source and message it for the "kick".
>
> Cheers,
> Ken
Yes, and on 10.5, you can also use the method - [NSObject
performSelector:onThread:withObject:waitUntilDone:], that will wake up
the target thread runloop.
| Related mails | Author | Date |
|---|---|---|
| Chris Idou | Aug 1, 13:43 | |
| Ken Thomases | Aug 1, 14:52 | |
| Jean-Daniel Dupas | Aug 1, 15:00 |






Cocoa mail archive

