Quantcast
Viewing all articles
Browse latest Browse all 30854

Thread Safety Using iterate_generic()

Hello again!

 

I was getting some very weird render results in my plugin when using the release version of the code on Windows. The debug version worked fine, so it was puzzling and difficult to nail down exactly where the problems might be occurring with the release version.

 

It turns out that the problem occurs rendering the scopes using iterate_generic().

 

My refcon has six PF_EffectWorld pointers - one for the sample world, and one each for the five scopes. I call iterate_generic() with n threads, where n = input->height. The function used by iterate_generic() just does row processing, sampling each pixel in the row indicated by the thread ID, and using the values to determine which pixel in each scope world gets drawn, and what colour, etc.

 

Once I ran the function explicitly (i.e. bypassing iterate_generic), adding an outer loop (for the y value) the plugin rendered correctly (and I must add, without too much, if any, decrease in performance which struck me as weird). So, something in my iterate function isn't thread safe. Any tips on writing functions for the iterate suite? The SDK guide states that functions must be re-entrant, which I'm not entirely confident about. Anyone use mutex to prevent multiple writes to the same memory (this invalidates re-entrancy, though, right?)?

 

Worst comes to the worst I'll have to live with the single threaded, inner-outer loop method, for the Windows version at least. But the aparrent lack of performance increase when using iterate_generic() makes me think that something is wrong internally.

 

Thanks,

 

Christian


Viewing all articles
Browse latest Browse all 30854

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>