Skip to content
Snippets Groups Projects
Commit 39ceef4f authored by John Romein's avatar John Romein
Browse files

bug 225:

Throw an exception if a system call fails.
parent 716809a6
No related branches found
No related tags found
No related merge requests found
......@@ -25,6 +25,7 @@
#include <IONProc/OutputThread.h>
#include <IONProc/ION_Allocator.h>
#include <Stream/SystemCallException.h>
namespace LOFAR {
......@@ -38,19 +39,15 @@ OutputThread::OutputThread(Stream *streamToStorage, unsigned nrBaselines, unsign
for (unsigned i = 0; i < maxSendQueueSize; i ++)
itsFreeQueue.append(new CorrelatedData(nrBaselines, nrChannels, hugeMemoryAllocator));
if (pthread_create(&thread, 0, mainLoopStub, this) != 0) {
std::cerr << "could not create output thread" << std::endl;
exit(1);
}
if (pthread_create(&thread, 0, mainLoopStub, this) != 0)
throw SystemCallException("pthread_create output thread", errno, THROW_ARGS);
}
OutputThread::~OutputThread()
{
if (pthread_join(thread, 0) != 0) {
std::cerr << "could not join output thread" << std::endl;
exit(1);
}
if (pthread_join(thread, 0) != 0)
throw SystemCallException("pthread_join output thread", errno, THROW_ARGS);
while (!itsFreeQueue.empty())
delete itsFreeQueue.remove();
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment