src/relpipe-out-chart.cpp
branchv_0
changeset 16 b6f790137bb8
parent 13 c84042d014c9
child 17 dad72beb3ebe
equal deleted inserted replaced
15:547a7c5681a5 16:b6f790137bb8
    22 
    22 
    23 	// TODO: better background thread; lambda?
    23 	// TODO: better background thread; lambda?
    24 
    24 
    25 	WorkerThread(std::shared_ptr<RelationalReader> reader) :
    25 	WorkerThread(std::shared_ptr<RelationalReader> reader) :
    26 	reader(reader) {
    26 	reader(reader) {
       
    27 		setTerminationEnabled(true);
    27 	}
    28 	}
    28 
    29 
    29 	void run() {
    30 	void run() {
    30 		try {
    31 		try {
    31 			reader->process();
    32 			reader->process();
    32 		} catch (RelpipeReaderException& e) {
    33 		} catch (RelpipeReaderException& e) {
    33 			// TODO: handle exception, show error dialog
    34 			// TODO: handle exception, show error dialog
       
    35 			std::wcerr << L"RelpipeReaderException: " << e.getMessge() << std::endl;
    34 		}
    36 		}
    35 	}
    37 	}
    36 };
    38 };
    37 
    39 
    38 int main(int argc, char**argv) {
    40 int main(int argc, char**argv) {
    65 	// window.signal123();
    67 	// window.signal123();
    66 
    68 
    67 	app.exec();
    69 	app.exec();
    68 	//return app.exec();
    70 	//return app.exec();
    69 
    71 
       
    72 	if (t.isRunning()) {
       
    73 		std::wcerr << L"Background RelationalReader thread is still running → terminate()" << std::endl;
       
    74 		t.terminate();
       
    75 		std::wcerr << L"Background RelationalReader thread was terminated → wait()" << std::endl;
       
    76 		t.wait();
       
    77 		std::wcerr << L"Background RelationalReader thread wait() finished" << std::endl;
       
    78 	}
       
    79 
    70 	return resultCode;
    80 	return resultCode;
    71 }
    81 }