void CgSoapMFCServerDlg::OnClickedStartSvr() { // TODO: Add your control notification handler code here if (!startSvr) { hSoapServerThd = MyThread(gSoapServer, &soapSvrThdid); } else { startSvr = false; ::MessageBox(0, _T("WebServer have been running!"), _T("Info"), MB_OK); ::MessageBox(0, _T("WebServer will be stoped!\nMaybe need another request!"), _T("Info"), MB_OK); } //struct soap s; //bool b; //HRESULT hr = ns__winconfig(&s, "TFTPServerIP", "", b); //HRESULT hr = SendConfigTable(); // StartgSoapServer(NULL); }
// This method starts the specified threads. // Ids [in] : IDs which are specified for starting threads. // NumOfIds [in] : Number of IDs // Return : Number of running threads when this method is called. int StkThreadManager::StartSpecifiedStkThreads(int Ids[MAX_NUM_OF_STKTHREADS], int NumOfIds) { static int Index[MAX_NUM_OF_STKTHREADS]; int NumOfRunThreads = StkThreadElement::NumOfRunThread; if (NumOfRunThreads < StkThreadElementCount) { CheckAndExecProcBeforeFirstThreadStarts(Ids, NumOfIds); } if (NumOfRunThreads < StkThreadElementCount) { // Change the status STARTING for target thread int TargetId[MAX_NUM_OF_STKTHREADS]; int TargetTh[MAX_NUM_OF_STKTHREADS]; int TargetCount = 0; for (int IdLoop = 0; IdLoop < NumOfIds; IdLoop++) { for (int ThLoop = 0; ThLoop < StkThreadElementCount; ThLoop++) { if (StkThreadArray[ThLoop]->GetId() == Ids[IdLoop] && StkThreadArray[ThLoop]->GetStatus() == STKTHREAD_STATUS_READY) { StkThreadArray[ThLoop]->SetStartStopFlag(true); TargetId[TargetCount] = Ids[IdLoop]; TargetTh[TargetCount] = ThLoop; TargetCount++; } } } // Start threads which are specified. for (int Loop = 0; Loop < TargetCount; Loop++) { Index[Loop] = TargetId[Loop]; std::thread MyThread(ThreadProc, Index[Loop]); MyThread.detach(); } } return NumOfRunThreads; }
void QVX_FEA::RequestSolveSystem(void) { bool Success = true; QString RetMessage = ""; Thread MyThread(&RetMessage); MyThread.LinkProgress(&CurProgTick, &CurProgMaxTick, &CurProgMsg, &CancelFlag); connect(&MyThread, SIGNAL(CallFunc(QString*)), this, SLOT(ExecuteSolveSystem(QString*)), Qt::DirectConnection); MyThread.Execute(); //broadcast if we succesfully completed the simulation if (RetMessage != ""){ QMessageBox::warning(NULL, "Warning", RetMessage); Success = false; //check if we were successful, first! (any return string is an error...) } emit SolveResult(Success); }