//------------------------------------------------------------------------------ /** @file "Pthreads/C++/Primer 1 - thread/test_buffer.cpp" @brief Program za ispitivanje klase deljenog bafera. */ //------------------------------------------------------------------------------ #include #include "ThreadCpp.h" #include "NitX.h" #include "NitY.h" #include "SemaphoreCpp.h" #include "BoundedBufferCpp.h" //------------------------------------------------------------------------------ using namespace std; //------------------------------------------------------------------------------ /** @brief Glavni program. @return int Rezultat izvrsavanja glavnog programa. U glavnom programu kreira se jedan bafer i vrsi nekoliko poziva put i get metoda. */ int main() { #ifdef WIN32 pthread_win32_process_attach_np(); #endif cout << "Start..." << endl; BoundedBufferCpp b(2); b.put(20); b.put(10); cout << b.get() << endl; b.put(21); cout << b.get() << endl; pthread_exit(0); cout << "... end." << endl; #ifdef WIN32 pthread_win32_process_detach_np(); #endif return 0; } //------------------------------------------------------------------------------