libcsdbg  1.28
C++ exception (and generic) stack trace debug library
streambuf & csdbg::streambuf::lock ( ) const
virtual

Lock the stream (exclusively)

Returns
*this
Exceptions
i32(errno)

Definition at line 188 of file streambuf.cpp.

References m_handle, and unlikely.

189 {
190  i32 retval;
191  do {
192  retval = flock(m_handle, LOCK_EX);
193  }
194  while ( unlikely(retval < 0 && errno == EINTR) );
195 
196  if ( unlikely(retval < 0) )
197  throw errno;
198 
199  return const_cast<streambuf&> (*this);
200 }
i32 m_handle
Stream handle (descriptor)
Definition: streambuf.hpp:43
streambuf()
Object default constructor.
Definition: streambuf.cpp:20
int i32
32-bit signed integer
Definition: config.hpp:82
#define unlikely(expr)
Offer a hint (negative) to the pipeline branch predictor.
Definition: config.hpp:349