summaryrefslogtreecommitdiff
path: root/tunDevice.cpp
diff options
context:
space:
mode:
authorChristian Pointner <equinox@anytun.org>2007-06-20 18:56:52 +0000
committerChristian Pointner <equinox@anytun.org>2007-06-20 18:56:52 +0000
commitd5a4ad9dddf7b057f9ccbbb0c349d37ec425fc26 (patch)
tree960a83fee909f14ff235b515f75d5cc20411d85f /tunDevice.cpp
parentbegin multi threading (diff)
added syslog class
added threads for receiving und sending
Diffstat (limited to 'tunDevice.cpp')
-rw-r--r--tunDevice.cpp4
1 files changed, 3 insertions, 1 deletions
diff --git a/tunDevice.cpp b/tunDevice.cpp
index 2dc7971..e4cc5af 100644
--- a/tunDevice.cpp
+++ b/tunDevice.cpp
@@ -38,6 +38,7 @@ extern "C" {
}
#include "tunDevice.h"
+#include "threadUtils.hpp"
TunDevice::TunDevice(const char* dev_name, const char* ifcfg_lp, const char* ifcfg_rnmp)
@@ -119,6 +120,7 @@ short TunDevice::read(Buffer& buf)
pfd[0].events = POLLIN | POLLPRI;
pfd[0].revents = 0;
poll(pfd, 1, -1);
+ Lock lock(io_mutex_);
return read_tun(dev_, buf, buf.getLength());
}
@@ -126,7 +128,7 @@ int TunDevice::write(Buffer& buf)
{
if(!dev_)
return -1;
-
+ Lock lock(io_mutex_);
return write_tun(dev_, buf, buf.getLength());
}