本文整理汇总了C++中VALID_TASK函数的典型用法代码示例。如果您正苦于以下问题:C++ VALID_TASK函数的具体用法?C++ VALID_TASK怎么用?C++ VALID_TASK使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了VALID_TASK函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: isc_task_sendanddetach
void
isc_task_sendanddetach(isc_task_t **taskp, isc_event_t **eventp) {
isc_boolean_t idle1, idle2;
isc_task_t *task;
/*
* Send '*event' to '*taskp' and then detach '*taskp' from its
* task.
*/
REQUIRE(taskp != NULL);
task = *taskp;
REQUIRE(VALID_TASK(task));
XTRACE("isc_task_sendanddetach");
LOCK(&task->lock);
idle1 = task_send(task, eventp);
idle2 = task_detach(task);
UNLOCK(&task->lock);
/*
* If idle1, then idle2 shouldn't be true as well since we're holding
* the task lock, and thus the task cannot switch from ready back to
* idle.
*/
INSIST(!(idle1 && idle2));
if (idle1 || idle2)
task_ready(task);
*taskp = NULL;
}
示例2: isc_task_exiting
isc_boolean_t
isc_task_exiting(isc_task_t *t) {
isc__task_t *task = (isc__task_t *)t;
REQUIRE(VALID_TASK(task));
return (TASK_SHUTTINGDOWN(task));
}
示例3: isc__task_getname
ISC_TASKFUNC_SCOPE const char *
isc__task_getname(isc_task_t *task0) {
isc__task_t *task = (isc__task_t *)task0;
REQUIRE(VALID_TASK(task));
return (task->name);
}
示例4: isc__task_gettag
ISC_TASKFUNC_SCOPE void *
isc__task_gettag(isc_task_t *task0) {
isc__task_t *task = (isc__task_t *)task0;
REQUIRE(VALID_TASK(task));
return (task->tag);
}
示例5: isc__task_getcurrenttime
ISC_TASKFUNC_SCOPE void
isc__task_getcurrenttime(isc_task_t *task0, isc_stdtime_t *t) {
isc__task_t *task = (isc__task_t *)task0;
REQUIRE(VALID_TASK(task));
REQUIRE(t != NULL);
LOCK(&task->lock);
*t = task->now;
UNLOCK(&task->lock);
}
示例6: isc__taskmgr_setexcltask
ISC_TASKFUNC_SCOPE void
isc__taskmgr_setexcltask(isc_taskmgr_t *mgr0, isc_task_t *task0) {
isc__taskmgr_t *mgr = (isc__taskmgr_t *) mgr0;
isc__task_t *task = (isc__task_t *) task0;
REQUIRE(VALID_MANAGER(mgr));
REQUIRE(VALID_TASK(task));
if (mgr->excl != NULL)
isc__task_detach((isc_task_t **) &mgr->excl);
isc__task_attach(task0, (isc_task_t **) &mgr->excl);
}
示例7: isc_task_getcurrenttime
void
isc_task_getcurrenttime(isc_task_t *task, isc_stdtime_t *t) {
REQUIRE(VALID_TASK(task));
REQUIRE(t != NULL);
LOCK(&task->lock);
*t = task->now;
UNLOCK(&task->lock);
}
示例8: isc_task_setname
void
isc_task_setname(isc_task_t *task, const char *name, void *tag) {
/*
* Name 'task'.
*/
REQUIRE(VALID_TASK(task));
LOCK(&task->lock);
memset(task->name, 0, sizeof(task->name));
strncpy(task->name, name, sizeof(task->name) - 1);
task->tag = tag;
UNLOCK(&task->lock);
}
示例9: isc_task_shutdown
void
isc_task_shutdown(isc_task_t *task) {
isc_boolean_t was_idle;
/*
* Shutdown 'task'.
*/
REQUIRE(VALID_TASK(task));
LOCK(&task->lock);
was_idle = task_shutdown(task);
UNLOCK(&task->lock);
if (was_idle)
task_ready(task);
}
示例10: isc_task_attach
void
isc_task_attach(isc_task_t *source, isc_task_t **targetp) {
/*
* Attach *targetp to source.
*/
REQUIRE(VALID_TASK(source));
REQUIRE(targetp != NULL && *targetp == NULL);
XTTRACE(source, "isc_task_attach");
LOCK(&source->lock);
source->references++;
UNLOCK(&source->lock);
*targetp = source;
}
示例11: isc__task_purgeevent
ISC_TASKFUNC_SCOPE isc_boolean_t
isc__task_purgeevent(isc_task_t *task0, isc_event_t *event) {
isc__task_t *task = (isc__task_t *)task0;
isc_event_t *curr_event, *next_event;
/*
* Purge 'event' from a task's event queue.
*
* XXXRTH: WARNING: This method may be removed before beta.
*/
REQUIRE(VALID_TASK(task));
/*
* If 'event' is on the task's event queue, it will be purged,
* unless it is marked as unpurgeable. 'event' does not have to be
* on the task's event queue; in fact, it can even be an invalid
* pointer. Purging only occurs if the event is actually on the task's
* event queue.
*
* Purging never changes the state of the task.
*/
LOCK(&task->lock);
for (curr_event = HEAD(task->events);
curr_event != NULL;
curr_event = next_event) {
next_event = NEXT(curr_event, ev_link);
if (curr_event == event && PURGE_OK(event)) {
DEQUEUE(task->events, curr_event, ev_link);
break;
}
}
UNLOCK(&task->lock);
if (curr_event == NULL)
return (ISC_FALSE);
isc_event_free(&curr_event);
return (ISC_TRUE);
}
示例12: isc__task_send
ISC_TASKFUNC_SCOPE void
isc__task_send(isc_task_t *task0, isc_event_t **eventp) {
isc__task_t *task = (isc__task_t *)task0;
isc_boolean_t was_idle;
/*
* Send '*event' to 'task'.
*/
REQUIRE(VALID_TASK(task));
XTRACE("isc_task_send");
/*
* We're trying hard to hold locks for as short a time as possible.
* We're also trying to hold as few locks as possible. This is why
* some processing is deferred until after the lock is released.
*/
LOCK(&task->lock);
was_idle = task_send(task, eventp);
UNLOCK(&task->lock);
if (was_idle) {
/*
* We need to add this task to the ready queue.
*
* We've waited until now to do it because making a task
* ready requires locking the manager. If we tried to do
* this while holding the task lock, we could deadlock.
*
* We've changed the state to ready, so no one else will
* be trying to add this task to the ready queue. The
* only way to leave the ready state is by executing the
* task. It thus doesn't matter if events are added,
* removed, or a shutdown is started in the interval
* between the time we released the task lock, and the time
* we add the task to the ready queue.
*/
task_ready(task);
}
}
示例13: dequeue_events
static unsigned int
dequeue_events(isc_task_t *task, void *sender, isc_eventtype_t first,
isc_eventtype_t last, void *tag,
isc_eventlist_t *events, isc_boolean_t purging)
{
isc_event_t *event, *next_event;
unsigned int count = 0;
REQUIRE(VALID_TASK(task));
REQUIRE(last >= first);
XTRACE("dequeue_events");
/*
* Events matching 'sender', whose type is >= first and <= last, and
* whose tag is 'tag' will be dequeued. If 'purging', matching events
* which are marked as unpurgable will not be dequeued.
*
* sender == NULL means "any sender", and tag == NULL means "any tag".
*/
LOCK(&task->lock);
for (event = HEAD(task->events); event != NULL; event = next_event) {
next_event = NEXT(event, ev_link);
if (event->ev_type >= first && event->ev_type <= last &&
(sender == NULL || event->ev_sender == sender) &&
(tag == NULL || event->ev_tag == tag) &&
(!purging || PURGE_OK(event))) {
DEQUEUE(task->events, event, ev_link);
ENQUEUE(*events, event, ev_link);
count++;
}
}
UNLOCK(&task->lock);
return (count);
}
示例14: isc__task_onshutdown
ISC_TASKFUNC_SCOPE isc_result_t
isc__task_onshutdown(isc_task_t *task0, isc_taskaction_t action,
const void *arg)
{
isc__task_t *task = (isc__task_t *)task0;
isc_boolean_t disallowed = ISC_FALSE;
isc_result_t result = ISC_R_SUCCESS;
isc_event_t *event;
/*
* Send a shutdown event with action 'action' and argument 'arg' when
* 'task' is shutdown.
*/
REQUIRE(VALID_TASK(task));
REQUIRE(action != NULL);
event = isc_event_allocate(task->manager->mctx,
NULL,
ISC_TASKEVENT_SHUTDOWN,
action,
arg,
sizeof(*event));
if (event == NULL)
return (ISC_R_NOMEMORY);
LOCK(&task->lock);
if (TASK_SHUTTINGDOWN(task)) {
disallowed = ISC_TRUE;
result = ISC_R_SHUTTINGDOWN;
} else
ENQUEUE(task->on_shutdown, event, ev_link);
UNLOCK(&task->lock);
if (disallowed)
isc_mem_put(task->manager->mctx, event, sizeof(*event));
return (result);
}
示例15: isc_task_detach
void
isc_task_detach(isc_task_t **taskp) {
isc_task_t *task;
isc_boolean_t was_idle;
/*
* Detach *taskp from its task.
*/
REQUIRE(taskp != NULL);
task = *taskp;
REQUIRE(VALID_TASK(task));
XTRACE("isc_task_detach");
LOCK(&task->lock);
was_idle = task_detach(task);
UNLOCK(&task->lock);
if (was_idle)
task_ready(task);
*taskp = NULL;
}