TutCbSetPriority set the priority of a callback
cb
callback to set priority of
pri
new value for priority
TRUE
if successful, FALSE
otherwise.
None
TutCbSetPriority sets the priority of cb
to pri
. The priority is applied dynamically to the list specified, causing the order of callbacks to be changed, even if the list to which the callback belongs is active. This may result in a callback being skipped during the current traversal, or not called at all, depending on the priority of the current callback.
When the list is reordered, a newly prioritized callback is placed at the end of all callbacks with a matching priority.
If the new priority matches the current priority of the callback, the list is not changed.
New callbacks are created with a priority of 0
. Callback priorities range from -32768
to 32767
.
May cause callbacks to be repeated or missed if used during callback list processing.
This example increments the priority of a callback. Every time the callback is called, its priority is incremented by one.
static void T_ENTRY time_change_cb(dummy, data, arg) T_PTR dummy;/* always NULL */
T_TIME_CHANGE_CB_DATA data; T_CB_ARG arg; { T_CB_PRIORITY cb_pri; TutOut("Time change callback called\n"); if (!TutCbGetPriority(data->cb, &cb_pri)) {/* error */
} cb_pri++; if (!TutCbSetPriority(data->cb, cb_pri)) {/* error */
} } ... if (!TutTimeChangeCbCreate(time_change_cb, NULL) == NULL) {/* error */
}
TIBCO SmartSockets™ Utilities Software Release 6.8, July 2006 Copyright © TIBCO Software Inc. All rights reserved www.tibco.com |