Re: Threads in Apps
Re: Threads in Apps
- Subject: Re: Threads in Apps
- From: "Nick Emery" <email@hidden>
- Date: Tue, 05 Jun 2001 08:31:10 +0100
- Organization: Peramon technology Ltd
>
I would like to also ask, as Ken Tabb has, what the best way to set up a
>
multi-threaded application without running headlong into problems with
>
the AppKit not being thread-safe is. Multiple people have asked this
>
and have not received answers, perhaps they were posting to the
>
OmniGroup's also, but if there is any good tutorial or sample code for
>
this or even a paragraph-long design philosophy, what is it?
i would also like an answer to this question as it applies to java and the appkit.
so far, the only way have have found that a java subthread can signal the main thread (where the ui and appkit are running) is to use an appDefined event which is process by an NSApplication subclass and causes suitable methods to be invoked in suitable objects. However, this approach is extremely messy because the appDefined events get mixed in with the ui events and there appears to be some strange timing behaviours (i suspect that the ui events are forcibly posted at the front of the event queue).
i have tried other approaches in java including: sending a notification to the default notification center and to the default queue of the default notification. both of these approaches result in the target method being called in the subthread. I have also tried the distibuted notification center. This seems at least to call the target methods in the main appkit thread, but it appears to go deaf after a short while.
--nikki