diff --git a/include/octopos.h b/include/octopos.h index 522a231..1b16bff 100644 --- a/include/octopos.h +++ b/include/octopos.h @@ -143,7 +143,7 @@ class octopOS { /*! The ids of the used semaphores */ static std::vector semids; /*! The global list of tentacles used for communication with children */ - static std::vector> tentacles; + static std::vector tentacles; /*! Pointers to locations inside the shared memory segment. Used for * allocation */ static intptr_t *shared_ptr, *shared_end_ptr; diff --git a/src/octopos.cpp b/src/octopos.cpp index 3604dd4..c07b9ad 100644 --- a/src/octopos.cpp +++ b/src/octopos.cpp @@ -34,7 +34,7 @@ void octopOS::sig_handler(int sig) { } } for (unsigned i = 0; i < NUMMODULES; ++i) { - tentacles.pop_back(); + delete tentacles[i]; if (msgctl(tentacle_ids[i], IPC_RMID, NULL) < 0) { if (sig < 0) throw std::system_error( @@ -87,8 +87,7 @@ octopOS::octopOS() { std::generic_category(), "Unable to create message queues"); } else { - tentacles.push_back(std::make_shared( - tentacle(MSGKEY + i))); + tentacles.push_back(new tentacle(MSGKEY + i)); } } @@ -131,7 +130,7 @@ std::pair octopOS::create_new_topic } void* octopOS::listen_for_child(void* tentacle_id) { - std::shared_ptr t = tentacles[*(int*)tentacle_id]; // NOLINT + tentacle* t = tentacles[*(int*)tentacle_id]; // NOLINT std::pair data; // NOLINT for (;;) { @@ -299,7 +298,7 @@ octopOS::~octopOS() { int octopOS::shmid = 0; int octopOS::tentacle_ids[NUMMODULES]; -std::vector> octopOS::tentacles; +std::vector octopOS::tentacles; std::vector octopOS::semids; intptr_t *octopOS::shared_ptr, *octopOS::shared_end_ptr; std::unordered_map