wxExecute and wxExec_sync

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
asadilan
Earned some good credits
Earned some good credits
Posts: 147
Joined: Tue Jul 27, 2010 10:42 pm

wxExecute and wxExec_sync

Post by asadilan » Tue Dec 24, 2013 6:46 pm

Hi All,

Happy holidays for all of you.

I have a problem with wxExecute and wxExec_Sync.

sometimes wxExecute would still wait for the process to return while the process is gone (does not exist).
i know it doesnt exist because i cant find it in task manager.

replicating the issue is not easy but i know it does happen because it hapenned more than once.
below is an excerpt of my code.

Please advise,

TIA
Asadilan

Code: Select all


    wxProcess *process = new wxProcess(wxPROCESS_DEFAULT);
    wxString command;
    command.Printf("testSimulator.exe A ");
 
    
    long pid =0;
    int iteration=1;
    
    int count = 0;
    while (true)//run again
    {
        if (!process->Exists(pid))
        {            
            pid = wxExecute(command, wxEXEC_SYNC | wxEXEC_MAKE_GROUP_LEADER, process);
        }
        Sleep(3000);        
    }
    wxDELETE(process);
   
    return iteration;

ONEEYEMAN
Part Of The Furniture
Part Of The Furniture
Posts: 4054
Joined: Sat Apr 16, 2005 7:22 am
Location: USA, Ukraine

Re: wxExecute and wxExec_sync

Post by ONEEYEMAN » Sat Dec 28, 2013 9:55 am

Hi,
What is you system/compiler? Can you reproduce it in the thread sample?

Thank you.

Post Reply