Commit 65798edc authored by Oliver Heidmann's avatar Oliver Heidmann
Browse files

merged

parent a843e464
...@@ -93,11 +93,12 @@ registerPstream(Pstream *p_pstreamPtr) ...@@ -93,11 +93,12 @@ registerPstream(Pstream *p_pstreamPtr)
return next_pstream_id - 1; return next_pstream_id - 1;
} }
Pstream::Pstream(std::string p_filename) : CdoStream(registerPstream(this)), m_name(p_filename), ispipe(false) { init(); } Pstream::Pstream(std::string p_filename) : CdoStream(registerPstream(this)), m_name(p_filename){ispipe = false;}
Pstream::Pstream(int p_processID) : CdoStream(registerPstream(this)), ispipe(true) Pstream::Pstream(int p_processID) : CdoStream(registerPstream(this))
{ {
init(); init();
ispipe = true;
pipe = std::make_shared<pipe_t>(); pipe = std::make_shared<pipe_t>();
pipe->pipeSetName(p_processID, m_cdoStreamID); pipe->pipeSetName(p_processID, m_cdoStreamID);
m_name = pipe->name; m_name = pipe->name;
...@@ -301,6 +302,7 @@ Pstream::closePipe() ...@@ -301,6 +302,7 @@ Pstream::closePipe()
// pthread_mutex_unlock(pipe->m_mutex); // pthread_mutex_unlock(pipe->m_mutex);
// pthread_cond_signal(pipe->isclosed); // pthread_cond_signal(pipe->isclosed);
Debug(PSTREAM,"Joining with write thread: %ld", wthreadID);
pthread_join(wthreadID, nullptr); pthread_join(wthreadID, nullptr);
} }
...@@ -315,6 +317,7 @@ Pstream::waitForPipe() ...@@ -315,6 +317,7 @@ Pstream::waitForPipe()
{ {
pipe->close(); pipe->close();
std::unique_lock<std::mutex> locked_mutex(pipe->m_mutex); std::unique_lock<std::mutex> locked_mutex(pipe->m_mutex);
Debug(PSTREAM,"Waiting for pipe");
while (isopen) while (isopen)
{ {
Debug(PSTREAM, "wait of read close"); Debug(PSTREAM, "wait of read close");
......
...@@ -75,9 +75,7 @@ public: ...@@ -75,9 +75,7 @@ public:
int getFileID(); int getFileID();
int m_mode; int m_mode;
bool ispipe;
bool isopen; bool isopen;
std::string m_name; std::string m_name;
std::vector<varlist_t> m_varlist; std::vector<varlist_t> m_varlist;
#ifdef HAVE_LIBPTHREAD #ifdef HAVE_LIBPTHREAD
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment