本文整理汇总了C++中ACTIVE_TASK::unsuspend方法的典型用法代码示例。如果您正苦于以下问题:C++ ACTIVE_TASK::unsuspend方法的具体用法?C++ ACTIVE_TASK::unsuspend怎么用?C++ ACTIVE_TASK::unsuspend使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ACTIVE_TASK
的用法示例。
在下文中一共展示了ACTIVE_TASK::unsuspend方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: unsuspend_all
// resume all currently scheduled tasks
//
void ACTIVE_TASK_SET::unsuspend_all() {
unsigned int i;
ACTIVE_TASK* atp;
for (i=0; i<active_tasks.size(); i++) {
atp = active_tasks[i];
if (atp->scheduler_state != CPU_SCHED_SCHEDULED) continue;
if (atp->task_state() == PROCESS_UNINITIALIZED) {
if (atp->start(false)) {
msg_printf(atp->wup->project, MSG_INTERNAL_ERROR,
"Couldn't restart task %s", atp->result->name
);
}
} else if (atp->task_state() == PROCESS_SUSPENDED) {
atp->unsuspend();
}
}
}
示例2: run_test_app
// The following runs "test_app" and sends it various messages.
// Used for testing the runtime system.
//
void run_test_app() {
WORKUNIT wu;
PROJECT project;
APP app;
APP_VERSION av;
ACTIVE_TASK at;
ACTIVE_TASK_SET ats;
RESULT result;
int retval;
char buf[256];
getcwd(buf, sizeof(buf)); // so we can see where we're running
gstate.run_test_app = true;
wu.project = &project;
wu.app = &app;
wu.command_line = string("--critical_section");
strcpy(app.name, "test app");
av.init();
av.avg_ncpus = 1;
strcpy(result.name, "test result");
result.avp = &av;
result.wup = &wu;
result.project = &project;
result.app = &app;
at.result = &result;
at.wup = &wu;
at.app_version = &av;
at.max_elapsed_time = 1e6;
at.max_disk_usage = 1e14;
at.max_mem_usage = 1e14;
strcpy(at.slot_dir, ".");
#if 1
// test file copy
//
ASYNC_COPY* ac = new ASYNC_COPY;
FILE_INFO fi;
retval = ac->init(&at, &fi, "big_file", "./big_file_copy");
if (retval) {
exit(1);
}
while (1) {
do_async_file_ops();
if (at.async_copy == NULL) {
break;
}
}
fprintf(stderr, "done\n");
exit(0);
#endif
ats.active_tasks.push_back(&at);
unlink("boinc_finish_called");
unlink("boinc_lockfile");
unlink("boinc_temporary_exit");
unlink("stderr.txt");
retval = at.start(true);
if (retval) {
fprintf(stderr, "start() failed: %s\n", boincerror(retval));
}
while (1) {
gstate.now = dtime();
at.preempt(REMOVE_NEVER);
ats.poll();
boinc_sleep(.1);
at.unsuspend();
ats.poll();
boinc_sleep(.2);
//at.request_reread_prefs();
}
}