delete i->p;
}
-// This function has a problem being inlined. Somehow, often when calling this, the size of the
-// resulting inlined code would be huge. Need to further debug this. (Disabled inliningfor now)
-
-prefix_ void senf::detail::PacketImpl::release(refcount_t n)
-{
- SENF_ASSERT(refcount_ >= n);
- // uah ... we need to be extremely careful here. If refcount_ is n, we want to commit suicide,
- // however the destructor will remove all PacketInterpreters from the list and will thereby
- // decrement refcount -> only decrenebt refcount_ when *not* caling delete
- if (refcount_ == n)
- delete this;
- else
- refcount_ -= n;
-}
-
// interpreter chain
prefix_ void senf::detail::PacketImpl::appendInterpreter(PacketInterpreterBase * p)
return data_.capacity();
}
+// This function has a problem being inlined. Somehow, often when calling this, the size of the
+// resulting inlined code would be huge?
+
+prefix_ void senf::detail::PacketImpl::release(refcount_t n)
+{
+ SENF_ASSERT(refcount_ >= n);
+ // uah ... we need to be extremely careful here. If refcount_ is n, we want to commit suicide,
+ // however the destructor will remove all PacketInterpreters from the list and will thereby
+ // decrement refcount -> only decrenebt refcount_ when *not* caling delete
+ if (refcount_ == n)
+ delete this;
+ else
+ refcount_ -= n;
+}
+
+
///////////////////////////////////////////////////////////////////////////
// senf::detail::PacketImpl::Guard
/* We don't take POLLIN/POLLOUT as argument to avoid having to include
sys/poll.h in the .cci file (and therefore indirectly into the .hh
and then every file which uses FileHandle) */
-prefix_ bool senf::FileBody::pollCheck(int fd, bool incoming, bool block)
+prefix_ bool senf::FileBody::pollCheck(int fd, bool incoming, bool block, bool oob)
const
{
struct ::pollfd pfd;
::memset(&pfd,0,sizeof(pfd));
pfd.fd = fd;
- pfd.events = incoming?POLLIN:POLLOUT;
+ pfd.events = incoming?(oob?POLLPRI:POLLIN):POLLOUT;
int rv = -1;
do {
rv = ::poll(&pfd,1,block?-1:0);
pollCheck(fd(),false,true);
}
+prefix_ bool senf::FileBody::oobReadable()
+ const
+{
+ return pollCheck(fd(),true,false,true);
+}
+
+prefix_ void senf::FileBody::waitOOBReadable()
+ const
+{
+ pollCheck(fd(),true,true,true);
+}
+
///////////////////////////////////////////////////////////////////////////
// senf::FileHandle
body().waitWriteable();
}
+prefix_ bool senf::FileHandle::oobReadable()
+ const
+{
+ return body().oobReadable();
+}
+
+prefix_ void senf::FileHandle::waitOOBReadable()
+ const
+{
+ body().waitOOBReadable();
+}
+
prefix_ bool senf::FileHandle::blocking()
const
{
///< (ignoring blocking state)
void waitWriteable() const; ///< Wait, until a write on the handle would not block
///< (ignoring blocking state)
+ bool oobReadable() const; ///< Check, whether a read of prioritized data on the handle
+ ///< would not block (ignoring blocking state)
+ void waitOOBReadable() const; ///< Wait, until read of prioritized data on the handle does
+ ///< not block (ignoring blocking state)
bool blocking() const; ///< Return current blocking state
void blocking(bool status); ///< Set blocking state
void waitReadable() const;
bool writeable() const;
void waitWriteable() const;
+ bool oobReadable() const;
+ void waitOOBReadable() const;
bool blocking() const;
void blocking(bool status);
protected:
private:
- bool pollCheck(int fd, bool incoming, bool block=false) const;
+ bool pollCheck(int fd, bool incoming, bool block=false, bool oob=false) const;
int fd_;
};