wxYield() blocking problem

If you are using the main C++ distribution of wxWidgets, Feel free to ask any question related to wxWidgets development here. This means questions regarding to C++ and wxWidgets, not compile problems.
Post Reply
Dotan
In need of some credit
In need of some credit
Posts: 1
Joined: Tue Feb 20, 2007 9:47 am

wxYield() blocking problem

Post 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!
Auria
Site Admin
Site Admin
Posts: 6695
Joined: Thu Sep 28, 2006 12:23 am
Contact:

Re: wxYield() blocking problem

Post 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.
Post Reply