[Adium-devl] Importer API

Graham Booker gbooker at cod3r.com
Wed Apr 11 19:07:05 UTC 2007


On Apr 11, 2007, at 3:16 AM, Ofri Wolfus wrote:
> All these talking about runloops made me think. Instead of  
> importing in another thread we can define the method as -(BOOL) 
> importLogWithError:(NSError *)err. It would then import *one* log  
> at a time (returning NO when no logs are left), and instead of  
> invoking it in a secondary thread, it would be added to the main  
> thread's runloop as an input source. This gives us responsive UI,  
> avoiding the thread-safety headache, easy canceling (by imply  
> invalidating the input source or removing it temporarily from the  
> runloop for pausing) and you could do any AppKit calls safely as  
> you'll be running in the main thread.
>

The problem with this comes into play if a log file takes a long time  
to process.  In the example of the Fire import, any XML files must be  
completely parsed and reformatted.  This can be a complex operation,  
and since Fire supported irc, these log files can be really really  
large.  With the thread, the responsiveness of the app is independent  
of the size of individual files, or the amount of processing required  
to import them.

What if a future importer deals with a SQL database or something like  
that, where the import operations essentially have to be done en- 
mass?  I think the thread method is the most flexible in the future,  
allowing the programmer to do expensive operations if they like.

> - Ofri
>
> - - - - - - - - - - - - - - - - - - -
> http://www.dpompa.com
> - - - - - - - - - - - - - - - - - - -



-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 1601 bytes
Desc: not available
URL: <http://adium.im/pipermail/devel_adium.im/attachments/20070411/ca827bd5/attachment.p7s>


More information about the devel mailing list