Code: Select all
for(...){
...
encryptDlg->done = false;
wxProcess* encryptProcess = new wxProcess(encryptDlg, 1);
encryptProcess->Redirect();
int exec = ::wxExecute(command,wxEXEC_ASYNC,encryptProcess);
if(exec == 0)
::wxMessageBox(wxT("Could not start encrypt process"));
//wxInputStream* inputStream = encryptProcess->GetInputStream();
wxOutputStream* outputStream = encryptProcess->GetOutputStream();
if(outputStream == NULL)
::wxMessageBox(wxT("No output stream"));
outputStream->Write(cryptSettings.getKey().c_str(),cryptSettings.getKey().Length());
while(!encryptDlg->done);
...
}
EncryptDlg::ProcessDone(){
done = true;
}
However, I found that the while loop freezes the program.
In Java, and for those of you who know java, I would have done something like this
//main thread object
synchronize(this){
new MyThread(this).start();
wait();
}
//sub thread
MyThread::run()
{
doEncryption();
synchronize(mainThread){
mainThread.notify();
}
}
How would I accomplish somethig like this in wxWidgets?