void test(struct mroutine_t *mr, int num) { int a = 1; mid_t a_mid = mr_create(mr, test_fun); int b = 1; mid_t b_mid = mr_create(mr, test_fun); int i = 0; while (i++ < num) { mr_resume(mr, a_mid, a++); mr_resume(mr, b_mid, b++); } }
static int mr_pm_callback(struct notifier_block *nb, unsigned long event, void *msg) { switch(event) { case MICPM_DEVEVENT_SUSPEND: mr_suspend(); break; case MICPM_DEVEVENT_RESUME: mr_resume(); break; case MICPM_DEVEVENT_FAIL_SUSPEND: mr_cancel(); break; default: /* * Ignore whatever else is sent this way */ break; } return 0; }