diff options
author | Pixel <pixel@nobis-crew.org> | 2012-04-08 22:03:50 -0700 |
---|---|---|
committer | Pixel <pixel@nobis-crew.org> | 2012-04-08 22:03:50 -0700 |
commit | cc78db0520ff384892cbee69557a38c3a1b04613 (patch) | |
tree | 01a05027d0d93d0a1253db56ed506087cc24aedb /src/Socket.cc | |
parent | dbf734fcf0ade3d92df31e4f0a7c0a5bd2b5605f (diff) |
Redifining yielding for operations a bit, making further refinements.
Diffstat (limited to 'src/Socket.cc')
-rw-r--r-- | src/Socket.cc | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/src/Socket.cc b/src/Socket.cc index d78c6e5..100b94e 100644 --- a/src/Socket.cc +++ b/src/Socket.cc @@ -243,7 +243,7 @@ static DNSRequest resolveName(const char * name, const char * service = NULL, st Balau::Printer::elog(Balau::E_SOCKET, "Sending a request to the resolver thread"); Balau::Task::prepare(&evt); resolverThread.pushRequest(&req); - Balau::Task::yield(&evt); + Balau::Task::operationYield(&evt); Balau::Atomic::MemoryFence(); @@ -476,7 +476,7 @@ bool Balau::Socket::connect(const char * hostname, int port) { IAssert(spins == 0, "We shouldn't have spinned..."); } - Task::yield(m_evtW, true); + Task::operationYield(m_evtW, Task::INTERRUPTIBLE); // if we're still here, it means the parent task doesn't want to be thrown an exception IAssert(m_evtW->gotSignal(), "We shouldn't have been awoken without getting our event signalled"); @@ -535,7 +535,7 @@ Balau::IO<Balau::Socket> Balau::Socket::accept() throw (GeneralException) { if (s < 0) { if ((errno == EAGAIN) || (errno == EINTR) || (errno == EWOULDBLOCK)) { - Task::yield(m_evtR, true); + Task::operationYield(m_evtR, Task::INTERRUPTIBLE); } else { String msg = getErrorMessage(); throw GeneralException(String("Unexpected error accepting a connection: #") + errno + "(" + msg + ")"); @@ -567,7 +567,7 @@ ssize_t Balau::Socket::read(void * buf, size_t count) throw (GeneralException) { } if ((errno == EAGAIN) || (errno == EINTR) || (errno == EWOULDBLOCK)) { - Task::yield(m_evtR, true); + Task::operationYield(m_evtR, Task::INTERRUPTIBLE); } else { m_evtR->stop(); return r; @@ -602,7 +602,7 @@ ssize_t Balau::Socket::write(const void * buf, size_t count) throw (GeneralExcep #endif if ((errno == EAGAIN) || (errno == EINTR) || (errno == EWOULDBLOCK)) { - Task::yield(m_evtW, true); + Task::operationYield(m_evtW, Task::INTERRUPTIBLE); } else { m_evtW->stop(); return r; |