25 #include <dbus/dbus-resources.h> 
   26 #include <dbus/dbus-internals.h> 
   61 #ifdef DBUS_ENABLE_STATS 
   63   long peak_unix_fd_value;  
 
  145   last_ref = (counter->
refcount == 0);
 
  178 #ifdef DBUS_ENABLE_STATS 
  179   if (counter->peak_size_value < counter->
size_value)
 
  180     counter->peak_size_value = counter->
size_value;
 
  184   _dbus_verbose (
"Adjusting counter %ld by %ld = %ld\n",
 
  189       ((old < counter->notify_size_guard_value &&
 
  209   DBusCounterNotifyFunction notify_function = 
NULL;
 
  210   void *notify_data = 
NULL;
 
  221   if (notify_function != 
NULL)
 
  222     (* notify_function) (counter, notify_data);
 
  247 #ifdef DBUS_ENABLE_STATS 
  253   _dbus_verbose (
"Adjusting counter %ld by %ld = %ld\n",
 
  258       ((old < counter->notify_unix_fd_guard_value &&
 
  304                           long                       size_guard_value,
 
  305                           long                       unix_fd_guard_value,
 
  306                           DBusCounterNotifyFunction  
function,
 
  318 #ifdef DBUS_ENABLE_STATS 
  320 _dbus_counter_get_peak_size_value (
DBusCounter *counter)
 
  322   return counter->peak_size_value;
 
  326 _dbus_counter_get_peak_unix_fd_value (
DBusCounter *counter)
 
  328   return counter->peak_unix_fd_value;
 
  
long size_value
current size counter value
DBusCounter * _dbus_counter_new(void)
Creates a new DBusCounter.
void _dbus_counter_unref(DBusCounter *counter)
Decrements refcount of the counter and possibly finalizes the counter.
long notify_unix_fd_guard_value
call notify function when crossing this unix fd value
void _dbus_counter_adjust_unix_fd(DBusCounter *counter, long delta)
Adjusts the value of the unix fd counter by the given delta which may be positive or negative.
long unix_fd_value
current unix fd counter value
long notify_size_guard_value
call notify function when crossing this size value
void _dbus_counter_adjust_size(DBusCounter *counter, long delta)
Adjusts the value of the size counter by the given delta which may be positive or negative.
void dbus_free(void *memory)
Frees a block of memory previously allocated by dbus_malloc() or dbus_malloc0().
void _dbus_counter_notify(DBusCounter *counter)
Calls the notify function from _dbus_counter_set_notify(), if that function has been specified and th...
dbus_bool_t notify_pending
TRUE if the guard value has been crossed.
DBUS_PRIVATE_EXPORT void _dbus_rmutex_unlock(DBusRMutex *mutex)
Unlocks a mutex.
DBUS_PRIVATE_EXPORT void _dbus_rmutex_lock(DBusRMutex *mutex)
Locks a mutex.
long _dbus_counter_get_unix_fd_value(DBusCounter *counter)
Gets the current value of the unix fd counter.
DBusRMutex * mutex
Lock on the entire DBusCounter.
Internals of DBusCounter.
#define _dbus_assert(condition)
DBusCounterNotifyFunction notify_function
notify function
long _dbus_counter_get_size_value(DBusCounter *counter)
Gets the current value of the size counter.
DBusCounter * _dbus_counter_ref(DBusCounter *counter)
Increments refcount of the counter.
void * notify_data
data for notify function
int refcount
reference count
void _dbus_counter_set_notify(DBusCounter *counter, long size_guard_value, long unix_fd_guard_value, DBusCounterNotifyFunction function, void *user_data)
Sets the notify function for this counter; the notify function is called whenever the counter's value...
#define dbus_new0(type, count)
void _dbus_rmutex_free_at_location(DBusRMutex **location_p)
Frees a DBusRMutex; does nothing if passed a NULL pointer.
void _dbus_rmutex_new_at_location(DBusRMutex **location_p)
Creates a new mutex or creates a no-op mutex if threads are not initialized.
dbus_uint32_t dbus_bool_t