As noted in dbus!524 by source code inspection, the Unix/pthread
implementation assumes that the timeout is non-negative and does not
support a mode where it blocks forever (which we normally represent as
a negative timeout, like POSIX poll(2)).
This means that it would be a programming error if we ever call
this with a negative timeout, so put an equivalent assertion in the
platform-independent layer. We recommend that assertions are disabled in
production builds, so it's "cheap" to have a redundant assertion here.
Signed-off-by: Simon McVittie <smcv@collabora.com>
*
* @param cond the condition variable
* @param mutex the mutex
- * @param timeout_milliseconds the maximum time to wait
+ * @param timeout_milliseconds the maximum time to wait, must be non-negative
* @returns #FALSE if the timeout occurred, #TRUE if not
*/
dbus_bool_t
DBusCMutex *mutex,
int timeout_milliseconds)
{
+ _dbus_assert (timeout_milliseconds >= 0);
+
if (cond == NULL || mutex == NULL)
return TRUE;