« Merry Christmas | Home | Happy new Year 2010 »


Over Christmas I wrote a simple set of functions I can use in my plugins to easily split work on several threads. So for example the Picture.ThreadedTransformMBS function takes a thread parameter. With value -1 no threads are using and the work runs on the main thread. But if you use the value 0, the plugin creates one thread for each CPU core. This way you can easily get a good number of threads. Also you can pass a positive number to get that number of threads.
The number of threads to use for a certain function can be difficult. Sometimes more threads than CPU cores makes the function run faster, because on all threads running on the system you get a higher split. Sometimes the overhead introduced with threads makes this inefficient to use a lot of threads.
The plugin functions for threads have another advantage: They yield on the REALbasic thread. So if you call the function Picture.ThreadedTransformMBS inside a REALbasic thread, it will yield time to the main REALbasic thread so you can update GUI:

If you need a plugin function to run faster using multithreading, send me an email. The biggest plugin in space...
27 12 09 - 18:08