How to wait for background worker to finish processing?

前端 未结 5 652
闹比i
闹比i 2021-01-19 17:07

I have 3 background workers each processing a channel of a 24-bit Bitmap image (Y, Cb, Cr). The processing for each 8-bit image takes several seconds and they might not com

5条回答
  •  攒了一身酷
    2021-01-19 17:54

    Maybe you could set and check flags in background worker complete event handlers. For example:

    private void backgroundWorkerN_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e)
    {
        y = true;
        if(cb && cr)//if cb and cr flags are true - other backgroundWorkers finished work
           someMethodToDoOtherStuff();
    }
    

提交回复
热议问题