Re: java cocoa appkit application and multiple threads
Re: java cocoa appkit application and multiple threads
- Subject: Re: java cocoa appkit application and multiple threads
- From: "Nick Emery" <email@hidden>
- Date: Fri, 01 Jun 2001 13:37:53 +0100
- Organization: Peramon technology Ltd
>
>> When my thread completes, it calls back to the window that spawned it >and
>
>> sets any data that was being generated. It all seems to work pretty >well.
>
>
>
> what do you mean by "calls back"? do you simply call the necessary >update
>
> methods from the extra thread?
>
>
Yeah, by calls back, I meant uses a reference to the window that spawned >it
>
to call a method to set the data that was returned.
there seems to be a problem with just calling back to deliver the results from the sub-thread. In the main thread, the dataSource for the NSTableView uses one call to get the table size, and another to get a cell's contents. it is therefore possible for the size of the table to change between the call to get the size and the call to get a cell.
so, is there a way for the sub-thread to signal the main thread using Java AppKit/Foundation framework calls once the processing has completed?
i've tried sending an action message: no good because it is delivered in the subthread.
i've tried sending a notification via the default NotificationCenter: no good again because it is delievered in the subthread.
i've tried sending a notification via the distributedNotificationCenter: this works, but the distributedNotificationCenter tends to go deaf when the queue gets about 5 notifications deep.
any other suggestions?
--nikki