Archived Forum Post

Index of archived forum posts


Whether chilkat compression and uploading supports multithreading?

Apr 23 '15 at 15:14

Hello chilkat,

In my cocoa application, i want to compress and upload two different big files in parallel. And I want to track upload 'percentDone' for both files at the same time. whether it is possible to compress, upload and track the upload details at the same time. I have event callbacks inside my code to track upload 'percentDone'.


I don't think it does support multithreading internally (don't see any Async* methods/properties like some other components), but the product page mentions that it is thread-safe. This implies that if your programming language has a way of creating threads, then you should be able to spawn threads and use compression objects in those threads.

The tricky part of your question though is compressing and uploading in parallel - I don't know if there's a way to start uploading before you are finished compressing (if that's what you are trying to do).


If the question is "are they thread-safe?", then the answer is Yes. If multiple threads try to call into the same object simultaneously, one will block until the other thread's method call is done. (Threads may call into different object instances simultaneously, of course.) Also, if using event callbacks, be careful in any programming language when updating UI elements from within a background thread. In any programming environment, the primary foreground thread is usually the one responsible for managing the UI. There may be issues (unrelated to Chilkat) in crossing thread boundaries w.r.t. to any UI in any programming language...