//------------------------------------------------------------------------------ /** @file "Pthreads/C++/Primer 1 - thread/test.cpp" @brief Program za ispitivanje klasa SemaphoreCpp i ThreadCpp. */ //------------------------------------------------------------------------------ #include #include "ThreadCpp.h" #include "NitX.h" #include "NitY.h" #include "SemaphoreCpp.h" #include "sleep.h" //------------------------------------------------------------------------------ using namespace std; //------------------------------------------------------------------------------ /** @brief Glavni program. @return int Rezultat izvrsavanja glavnog programa. U glavnom programu kreiramo dva nova semafora i dve nove niti. cekamo da niti zavrse izvrsavanje pre nego sto program zavrsi. @todo Razdvojiti primere test.cpp i test-buffer.cpp u dva direktorijuma. */ int main() { pthread_win32_process_attach_np(); cout << "Start..." << endl; SemaphoreCpp* s1 = new SemaphoreCpp(0); SemaphoreCpp* s2 = new SemaphoreCpp(0); int x, y, z; ThreadCpp* p = new NitX(s1, s2, &x, &y, &z); ThreadCpp* p1 = new NitY(s1, s2, &x, &y, &z); p->start(); p1->start(); ThreadCpp::dispose(p); ThreadCpp::dispose(p1); cout << "... end." << endl; pthread_exit(0); pthread_win32_process_detach_np(); } //------------------------------------------------------------------------------