Problem: 'bool' is not defined by default

zmq_atomic_counter_dec returned a 'bool' value, yet this isn't
defined by standard, so causes compile errors in upstream code.

Solution: return an int that can be safely converted to bool if
needed by bindings.
This commit is contained in:
Pieter Hintjens
2014-12-23 15:20:10 +01:00
parent ae53b27b70
commit 04664f0ef7
9 changed files with 49 additions and 42 deletions

View File

@@ -232,11 +232,12 @@ int zmq_atomic_counter_inc (void *counter_)
return ((zmq::atomic_counter_t *) counter_)->add (1);
}
// Decrement the atomic counter and return true if still > zero
// Decrement the atomic counter and return 1 (if counter >= 1), or
// 0 if counter hit zero.
bool zmq_atomic_counter_dec (void *counter_)
int zmq_atomic_counter_dec (void *counter_)
{
return ((zmq::atomic_counter_t *) counter_)->sub (1);
return ((zmq::atomic_counter_t *) counter_)->sub (1)? 1: 0;
}
// Return actual value of atomic counter