This commit fixes a data race condition discovered by the
gcc thread sanitizer by also locking the associated mutex
when reading the corresponding counter.
Fixes #426
long
_dbus_counter_get_size_value (DBusCounter *counter)
{
- return counter->size_value;
+ long result;
+ _dbus_rmutex_lock (counter->mutex);
+ result = counter->size_value;
+ _dbus_rmutex_unlock (counter->mutex);
+ return result;
}
/**
long
_dbus_counter_get_unix_fd_value (DBusCounter *counter)
{
- return counter->unix_fd_value;
+ long result;
+ _dbus_rmutex_lock (counter->mutex);
+ result = counter->unix_fd_value;
+ _dbus_rmutex_unlock (counter->mutex);
+ return result;
}
/**