thread problem Topic is solved

Do you have a typical platform dependent issue you're battling with ? Ask it here. Make sure you mention your platform, compiler, and wxWidgets version.
Post Reply
semo
In need of some credit
In need of some credit
Posts: 4
Joined: Wed Jan 13, 2016 1:29 pm

thread problem

Post by semo »

Hello.
Under OSX, wxWidget 3.0.2
I have a wxFrame and a worker c++ std::thread.

worker thread is very simple.

Code: Select all

void wt()
{
    for(;;)
    {
        do_something();
        std::this_thread::sleep_for(std::chrono::milliseconds(30)); // sleep 30ms
     }
}
When my wxFrame not the topmost window, sleep_for never return.
at that time,
If I move mouse around the wxFrame, sleep return and continue.

Under Windows, There's no problem.
Any help would be much appreciated.
Last edited by doublemax on Wed Jan 13, 2016 1:47 pm, edited 1 time in total.
Reason: Added code tags
Elmi
Super wx Problem Solver
Super wx Problem Solver
Posts: 293
Joined: Thu Mar 12, 2009 3:23 pm
Location: Germany
Contact:

Re: thread problem

Post by Elmi »

What is "do_something()" - are you performing some GUI operations there?
semo
In need of some credit
In need of some credit
Posts: 4
Joined: Wed Jan 13, 2016 1:29 pm

Re: thread problem

Post by semo »

do_something use socket function and not use any wxWidget functions.
semo
In need of some credit
In need of some credit
Posts: 4
Joined: Wed Jan 13, 2016 1:29 pm

Re: thread problem

Post by semo »

I solved the problem.
I changed my thread as real time thread.
semo
In need of some credit
In need of some credit
Posts: 4
Joined: Wed Jan 13, 2016 1:29 pm

Re: thread problem

Post by semo »

The problem was app nap feature of the OS X.
johnth1957
Earned a small fee
Earned a small fee
Posts: 10
Joined: Wed Feb 14, 2018 12:13 am

Re: thread problem

Post by johnth1957 »

I know this is an older thread but I am having issues where it seems like my worker threads are not really running in the back ground, is there a setting to make this what this said a real time thread?
User avatar
doublemax
Moderator
Moderator
Posts: 19160
Joined: Fri Apr 21, 2006 8:03 pm
Location: $FCE2

Re: thread problem

Post by doublemax »

johnth1957 wrote:I know this is an older thread but I am having issues where it seems like my worker threads are not really running in the back ground, is there a setting to make this what this said a real time thread?
Please open a new thread and explain the problem in more detail. Unless you explicitly Wait() on a joinable thread, they will always work in the background.
Use the source, Luke!
Post Reply