How to be sure that only one task will be running at the time?

In my program I’m working with camera. I broadcast the frames from the camera device to pictureBox element. While doing that, I also want to process some of those frames. But also I don’t want to interrupt the broadcasting of the frames to pictureBox element (so it would look smooth). I got this method (FrameProcessing), that processes frames, but I want to call it only if it isn’t already running (process only those frames that are taken when FrameProcessing isn’t running). How to achieve this? I’m not even sure that I should be using Tasks, because it is a new field to me. Thanks for your help!

submitted by /u/Gytermo
[link] [comments]

Leave a Reply