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;
 #define NULL
A null pointer, defined appropriately for C or C++. 
void dbus_free(void *memory)
Frees a block of memory previously allocated by dbus_malloc() or dbus_malloc0(). 
#define _dbus_assert(condition)
Aborts with an error message if the condition is false. 
Internals of DBusCounter. 
DBusCounterNotifyFunction notify_function
notify function 
DBusCounter * _dbus_counter_ref(DBusCounter *counter)
Increments refcount of the counter. 
void _dbus_rmutex_new_at_location(DBusRMutex **location_p)
Creates a new mutex or creates a no-op mutex if threads are not initialized. 
long size_value
current size counter value 
void * notify_data
data for notify function 
DBUS_PRIVATE_EXPORT void _dbus_rmutex_unlock(DBusRMutex *mutex)
Unlocks a mutex. 
#define dbus_new0(type, count)
Safe macro for using dbus_malloc0(). 
dbus_uint32_t dbus_bool_t
A boolean, valid values are TRUE and FALSE. 
void _dbus_counter_unref(DBusCounter *counter)
Decrements refcount of the counter and possibly finalizes the counter. 
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...
dbus_bool_t notify_pending
TRUE if the guard value has been crossed. 
long unix_fd_value
current unix fd counter value 
#define TRUE
Expands to "1". 
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...
void _dbus_counter_notify(DBusCounter *counter)
Calls the notify function from _dbus_counter_set_notify(), if that function has been specified and th...
DBusRMutex * mutex
Lock on the entire DBusCounter. 
long notify_unix_fd_guard_value
call notify function when crossing this unix fd value 
long notify_size_guard_value
call notify function when crossing this size value 
void _dbus_rmutex_free_at_location(DBusRMutex **location_p)
Frees a DBusRMutex; does nothing if passed a NULL pointer. 
DBusCounter * _dbus_counter_new(void)
Creates a new DBusCounter. 
DBUS_PRIVATE_EXPORT void _dbus_rmutex_lock(DBusRMutex *mutex)
Locks a mutex. 
int refcount
reference count 
#define FALSE
Expands to "0". 
long _dbus_counter_get_unix_fd_value(DBusCounter *counter)
Gets the current value of the unix fd counter. 
long _dbus_counter_get_size_value(DBusCounter *counter)
Gets the current value of the size counter. 
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...