Hey all,
I’m starting to experiment with preemptive threads in my app and so far, the results are amazing. In the application where I am using these, I am grabbing image data from multiple remote devices on the local network and painting them to a canvas. Think something like where you have a bunch of security cameras and you are getting their image data and showing them all on the screen in a matrix.
I’ve determined that the biggest culprit taking the most amount of CPU time is the conversion of the downloaded bitmap or JPEG string data (could be either one) into a picture. That operation is taking about 10 mS. By putting that and some other operations into a preemptive thread, everything works better. Until it doesn’t.
I’m seeing my app sometimes run for a long period of time doing this and there’s no problems. Other times it runs for a bit and the app silently crashes. No exceptions thrown nothing - it just quits. On a Windows machine where I have tested, I sometimes see runtime errors.
I’m assuming I’m not doing something correctly and that my code isn’t well enough protected with the preemptive threads and at some point, one thing steps on another and it all blows up. I wouldn’t be surprised. I think I’ve spent maybe 10 minutes with coding on this so far.
But where can I start to look or should I look to figure out where this silent fail is happening? If an exception was thrown, yeah, that would make it much simpler. But the silent fail is a challenge. So I’m just looking for ideas here on how to track that down…
Thanks
26 posts - 9 participants