Page 1 of 1

wxYield() blocking problem

Posted: Tue Feb 20, 2007 10:28 am
by Dotan
Hi,

I have a wx 2.4.2 installed.
I capture frames from a camera and then process and display them.

In order to have an infinite loop I post an event and catch it with the same function. Here is my code:

Code: Select all

void GMainFrame::OnCaptureFrame(wxCommandEvent& frameLoopEvent)
{
   panel->processFrame();
   wxYield();
   // Call the event loop to get back to this function.
   if (!_stopCapture)
      wxPostEvent(this, frameLoopEvent);
}
The function panel->processFrame() gets the frame, processes and displays it (with wxPanel).
I use wxYield() because the frame is not displayed without it.

My problem is that because of wxYield(), my program is halted each time that a wxMessgae is issued (until the OK bottun is pressed).
My question is: is there any alternative way to allow text and image display without blocking the program when a message is issued or when the menu is opened?

Thanks in advance!

Re: wxYield() blocking problem

Posted: Tue Feb 20, 2007 1:35 pm
by Auria
Dotan wrote:Hi,

I have a wx 2.4.2 installed.
I capture frames from a camera and then process and display them.

In order to have an infinite loop I post an event and catch it with the same function. Here is my code:

Code: Select all

void GMainFrame::OnCaptureFrame(wxCommandEvent& frameLoopEvent)
{
   panel->processFrame();
   wxYield();
   // Call the event loop to get back to this function.
   if (!_stopCapture)
      wxPostEvent(this, frameLoopEvent);
}
The function panel->processFrame() gets the frame, processes and displays it (with wxPanel).
I use wxYield() because the frame is not displayed without it.

My problem is that because of wxYield(), my program is halted each time that a wxMessgae is issued (until the OK bottun is pressed).
My question is: is there any alternative way to allow text and image display without blocking the program when a message is issued or when the menu is opened?

Thanks in advance!
Hi, first of all 2.4.2 is very old you should think of updating

second, wxYield doesn't make the program continue, it just lets the system breath so that processor-intense processes don't lock your screen, etc.