• Home
  • History
  • Annotate
  • Raw
  • Download
  • only in /netgear-R7000-V1.0.7.12_1.2.5/ap/gpl/iserver/dbus-1.6.8/dbus/

Lines Matching refs:counter

58   long size_value;       /**< current size counter value */
59 long unix_fd_value; /**< current unix fd counter value */
62 long peak_size_value; /**< largest ever size counter value */
63 long peak_unix_fd_value; /**< largest ever unix fd counter value */
85 * @returns new counter or #NULL on failure
90 DBusCounter *counter;
92 counter = dbus_new0 (DBusCounter, 1);
93 if (counter == NULL)
96 counter->refcount = 1;
98 return counter;
102 * Increments refcount of the counter
104 * @param counter the counter
105 * @returns the counter
108 _dbus_counter_ref (DBusCounter *counter)
110 _dbus_assert (counter->refcount > 0);
112 counter->refcount += 1;
114 return counter;
118 * Decrements refcount of the counter and possibly
119 * finalizes the counter.
121 * @param counter the counter
124 _dbus_counter_unref (DBusCounter *counter)
126 _dbus_assert (counter->refcount > 0);
128 counter->refcount -= 1;
130 if (counter->refcount == 0)
133 dbus_free (counter);
138 * Adjusts the value of the size counter by the given
144 * @param counter the counter
145 * @param delta value to add to the size counter's current value
148 _dbus_counter_adjust_size (DBusCounter *counter,
151 long old = counter->size_value;
153 counter->size_value += delta;
156 if (counter->peak_size_value < counter->size_value)
157 counter->peak_size_value = counter->size_value;
161 _dbus_verbose ("Adjusting counter %ld by %ld = %ld\n",
162 old, delta, counter->size_value);
165 if (counter->notify_function != NULL &&
166 ((old < counter->notify_size_guard_value &&
167 counter->size_value >= counter->notify_size_guard_value) ||
168 (old >= counter->notify_size_guard_value &&
169 counter->size_value < counter->notify_size_guard_value)))
170 counter->notify_pending = TRUE;
175 * if that function has been specified and the counter has crossed the
182 _dbus_counter_notify (DBusCounter *counter)
184 if (counter->notify_pending)
186 counter->notify_pending = FALSE;
187 (* counter->notify_function) (counter, counter->notify_data);
192 * Adjusts the value of the unix fd counter by the given
198 * @param counter the counter
199 * @param delta value to add to the unix fds counter's current value
202 _dbus_counter_adjust_unix_fd (DBusCounter *counter,
205 long old = counter->unix_fd_value;
207 counter->unix_fd_value += delta;
210 if (counter->peak_unix_fd_value < counter->unix_fd_value)
211 counter->peak_unix_fd_value = counter->unix_fd_value;
215 _dbus_verbose ("Adjusting counter %ld by %ld = %ld\n",
216 old, delta, counter->unix_fd_value);
219 if (counter->notify_function != NULL &&
220 ((old < counter->notify_unix_fd_guard_value &&
221 counter->unix_fd_value >= counter->notify_unix_fd_guard_value) ||
222 (old >= counter->notify_unix_fd_guard_value &&
223 counter->unix_fd_value < counter->notify_unix_fd_guard_value)))
224 counter->notify_pending = TRUE;
228 * Gets the current value of the size counter.
230 * @param counter the counter
234 _dbus_counter_get_size_value (DBusCounter *counter)
236 return counter->size_value;
240 * Gets the current value of the unix fd counter.
242 * @param counter the counter
246 _dbus_counter_get_unix_fd_value (DBusCounter *counter)
248 return counter->unix_fd_value;
252 * Sets the notify function for this counter; the notify function is
253 * called whenever the counter's values cross the guard values in
256 * @param counter the counter
257 * @param size_guard_value the value we're notified if the size counter crosses
258 * @param unix_fd_guard_value the value we're notified if the unix fd counter crosses
263 _dbus_counter_set_notify (DBusCounter *counter,
269 counter->notify_size_guard_value = size_guard_value;
270 counter->notify_unix_fd_guard_value = unix_fd_guard_value;
271 counter->notify_function = function;
272 counter->notify_data = user_data;
273 counter->notify_pending = FALSE;
278 _dbus_counter_get_peak_size_value (DBusCounter *counter)
280 return counter->peak_size_value;
284 _dbus_counter_get_peak_unix_fd_value (DBusCounter *counter)
286 return counter->peak_unix_fd_value;