Problem: inconsistent naming style for private data members, conflicts with naming of local variables and member functions

Solution: apply and check _lower_case naming style for private data members
This commit is contained in:
Simon Giesecke
2018-05-27 11:10:39 +02:00
parent 06cfd0d8ad
commit e3c73d9881
143 changed files with 5783 additions and 4051 deletions

View File

@@ -36,71 +36,71 @@ zmq::mailbox_t::mailbox_t ()
// Get the pipe into passive state. That way, if the users starts by
// polling on the associated file descriptor it will get woken up when
// new command is posted.
const bool ok = cpipe.check_read ();
const bool ok = _cpipe.check_read ();
zmq_assert (!ok);
active = false;
_active = false;
}
zmq::mailbox_t::~mailbox_t ()
{
// TODO: Retrieve and deallocate commands inside the cpipe.
// TODO: Retrieve and deallocate commands inside the _cpipe.
// Work around problem that other threads might still be in our
// send() method, by waiting on the mutex before disappearing.
sync.lock ();
sync.unlock ();
_sync.lock ();
_sync.unlock ();
}
zmq::fd_t zmq::mailbox_t::get_fd () const
{
return signaler.get_fd ();
return _signaler.get_fd ();
}
void zmq::mailbox_t::send (const command_t &cmd_)
{
sync.lock ();
cpipe.write (cmd_, false);
const bool ok = cpipe.flush ();
sync.unlock ();
_sync.lock ();
_cpipe.write (cmd_, false);
const bool ok = _cpipe.flush ();
_sync.unlock ();
if (!ok)
signaler.send ();
_signaler.send ();
}
int zmq::mailbox_t::recv (command_t *cmd_, int timeout_)
{
// Try to get the command straight away.
if (active) {
if (cpipe.read (cmd_))
if (_active) {
if (_cpipe.read (cmd_))
return 0;
// If there are no more commands available, switch into passive state.
active = false;
_active = false;
}
// Wait for signal from the command sender.
int rc = signaler.wait (timeout_);
int rc = _signaler.wait (timeout_);
if (rc == -1) {
errno_assert (errno == EAGAIN || errno == EINTR);
return -1;
}
// Receive the signal.
rc = signaler.recv_failable ();
rc = _signaler.recv_failable ();
if (rc == -1) {
errno_assert (errno == EAGAIN);
return -1;
}
// Switch into active state.
active = true;
_active = true;
// Get a command.
const bool ok = cpipe.read (cmd_);
const bool ok = _cpipe.read (cmd_);
zmq_assert (ok);
return 0;
}
bool zmq::mailbox_t::valid () const
{
return signaler.valid ();
return _signaler.valid ();
}