This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // ISU laboratory session #8, exercise #3. | |
| #include <osapi/Thread.hpp> | |
| #include <osapi/Message.hpp> | |
| #include <osapi/MsgQueue.hpp> | |
| #include <osapi/Utility.hpp> | |
| #include <iostream> | |
| #include "car.hpp" | |
| #include "EntryGuard.hpp" | |
| using namespace std; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // ISU laboratory session #8, exercise #3. | |
| #ifndef EXITGATE_HPP | |
| #define EXITGATE_HPP | |
| #include <osapi/Thread.hpp> | |
| #include <osapi/Message.hpp> | |
| #include <osapi/MsgQueue.hpp> | |
| #include <osapi/Utility.hpp> | |
| #include "car.hpp" | |
| struct exitGuardOpenReq : public osapi::Message |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // ISU laboratory session #8, exercise #3. | |
| #include <osapi/Thread.hpp> | |
| #include <osapi/Message.hpp> | |
| #include <osapi/MsgQueue.hpp> | |
| #include <osapi/Utility.hpp> | |
| #include <iostream> | |
| #include "car.hpp" | |
| #include "ExitGuard.hpp" | |
| using namespace std; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // ISU laboratory session #8, exercise #3. | |
| #ifndef CAR_HPP | |
| #define CAR_HPP | |
| #include <osapi/Thread.hpp> | |
| #include <osapi/Message.hpp> | |
| #include <osapi/MsgQueue.hpp> | |
| #include <osapi/Utility.hpp> | |
| #include "EntryGuard.hpp" | |
| #include "ExitGuard.hpp" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // ISU laboratory session #8, exercise #3. | |
| #include <osapi/Thread.hpp> | |
| #include <osapi/Message.hpp> | |
| #include <osapi/MsgQueue.hpp> | |
| #include <osapi/Utility.hpp> | |
| #include <unistd.h> | |
| #include <iostream> | |
| #include "car.hpp" | |
| using namespace std; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // ISU laboratory session #8, exercise #1. | |
| #ifndef OSAPI_LINUX_MUTEX_HPP | |
| #define OSAPI_LINUX_MUTEX_HPP | |
| #include <pthread.h> | |
| #include <osapi/Utility.hpp> | |
| namespace osapi | |
| { | |
| class Mutex : Notcopyable |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // ISU laboratory session #8, exercise #1. | |
| #include <iostream> | |
| //#include <osapi/Exceptions> | |
| #include <osapi/Mutex.hpp> | |
| namespace osapi | |
| { | |
| Mutex::Mutex() | |
| { | |
| if(pthread_mutex_init(&mtxID_, NULL)) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // ISU laboratory session #8, exercise #1. | |
| #include <errno.h> | |
| #include <osapi/ConditionalError.hpp> | |
| #include "osapi/linux/Mutex.hpp" | |
| #include <osapi/linux/Conditional.hpp> | |
| namespace osapi | |
| { | |
| Conditional::Conditional() | |
| { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // ISU laboratory session #8, exercise #1. | |
| #include <osapi/Utility.hpp> | |
| #include <unistd.h> | |
| namespace osapi | |
| { | |
| void sleep(unsigned long msecs) | |
| { | |
| usleep(msecs * 1000); //Converts miliseconds to seconds | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // ISU laboratory session #8, exercise #1. | |
| #include <unistd.h> | |
| #include <errno.h> | |
| #include <iostream> | |
| #include <osapi/Thread.hpp> | |
| //#include <osapi/ThreadFunctor.hpp> | |
| namespace osapi | |
| { | |
| Thread::Thread(ThreadFunctor* tf, |