class Test: public CppUnit::TestFixture { public: // Nondeterministic, best effort test that an osl::Thread can be destroyed // (and in particular osl_destroyThread---indirectly---be called) before the // corresponding thread has terminated: void test() { for (int i = 0; i < 50; ++i) {
osl::Condition c;
Thread t(c);
CPPUNIT_ASSERT(t.create()); // Make sure virtual Thread::run/onTerminated are called before // Thread::~Thread:
CPPUNIT_ASSERT_EQUAL(osl::Condition::result_ok, c.wait());
} // Make sure Thread::~Thread is called before each spawned thread // terminates:
global.set(); // Give the spawned threads enough time to terminate:
osl::Thread::wait(std::chrono::seconds(20));
}
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.