12345678910111213141516171819202122232425262728293031323334353637383940414243 |
- #include <QCoreApplication>
- #include <thread>
- #include "ivbacktrace.h"
- #include "ivlog.h"
- #include "ivfault.h"
- #include "ivexit.h"
- iv::Ivlog * givlog;
- void testthread()
- {
- int i;
- i = 0;
- while(i<3)
- {
- std::this_thread::sleep_for(std::chrono::milliseconds(1000));
- i++;
- }
- // int *p = 0;
- // *p = 1;
- }
- void exitcall()
- {
- givlog->warn("testivexit exit.");
- std::this_thread::sleep_for(std::chrono::milliseconds(100));
- }
- int main(int argc, char *argv[])
- {
- QCoreApplication a(argc, argv);
- RegisterIVBackTrace();
- givlog = new iv::Ivlog("testivexit");
- iv::ivexit::RegIVExitCall(exitcall);
- std::thread at(testthread);
- return a.exec();
- }
|