Merge with ns-3-dev

This commit is contained in:
socket
2011-08-16 20:26:04 +02:00
2 changed files with 19 additions and 13 deletions

View File

@@ -110,15 +110,13 @@ void FdReader::Stop (void)
{
m_stop = true;
// signal the read thread and close the write end of the event pipe
// signal the read thread
if (m_evpipe[1] != -1)
{
char zero = 0;
ssize_t len = write (m_evpipe[1], &zero, sizeof (zero));
if (len != sizeof (zero))
NS_LOG_WARN ("incomplete write(): " << strerror (errno));
close (m_evpipe[1]);
m_evpipe[1] = -1;
}
// join the read thread
@@ -128,6 +126,13 @@ void FdReader::Stop (void)
m_readThread = 0;
}
// close the write end of the event pipe
if (m_evpipe[1] != -1)
{
close (m_evpipe[1]);
m_evpipe[1] = -1;
}
// close the read end of the event pipe
if (m_evpipe[0] != -1)
{
@@ -167,26 +172,26 @@ void FdReader::Run (void)
if (FD_ISSET (m_evpipe[0], &readfds))
{
// drain the event pipe
ssize_t len;
for (;;)
{
char buf[1024];
len = read (m_evpipe[0], buf, sizeof (buf));
ssize_t len = read (m_evpipe[0], buf, sizeof (buf));
if (len == 0)
{
NS_FATAL_ERROR ("event pipe closed");
}
if (len < 0)
{
break;
if (errno == EAGAIN || errno == EINTR || errno == EWOULDBLOCK)
{
break;
}
else
{
NS_FATAL_ERROR ("read() failed: " << strerror (errno));
}
}
}
if (len < 0 && errno != EAGAIN && errno != EWOULDBLOCK)
{
NS_LOG_WARN ("read() failed: " << strerror (errno));
break;
}
}
if (m_stop)

View File

@@ -827,7 +827,8 @@ def shutdown(ctx):
if ((not Options.options.run)
and (not Options.options.pyrun)
and ('clean' not in Options.arg_line)
and ('distclean' not in Options.arg_line)):
and ('distclean' not in Options.arg_line)
and ('shell' not in Options.arg_line)):
# Print the list of built modules.
print