/* ************************************************************************************************************************ * Create an active object * * Description: This function is called to post an event to active object * * Arguments :me is the address of this active object * --------- * prio is the priority of this active object * --------- * msg_start is the start address of active queue which is belonged to this active object * --------- * qLen is the active queue length * --------- * stkSto is the start stack address of this active object * --------- * stkSize is the stack size of this active object * --------- * event is the init event. * Returns * * Note(s) * * ************************************************************************************************************************ */ void active_object_create(ACTIVE_OBJECT_STRUCT *me, RAW_U8 prio, void **msg_start, RAW_U32 qLen, void *stkSto, RAW_U32 stkSize, STATE_EVENT *event) { RAW_OS_ERROR err; err = raw_queue_create(&me->active_queue, (RAW_U8 *)"queue", msg_start, qLen); if (err != RAW_SUCCESS) { RAW_ASSERT(0); } me->prio = prio; hsm_init(&me->father, event); me->user_data = 1; err = raw_task_create(&me->thread, (RAW_U8 *)"task5", me, me->prio, 0, stkSto, stkSize, active_task_function, 1); if (err != RAW_SUCCESS) { RAW_ASSERT(0); } }
int main(int argc, char * const argv[]) { int opt, i, ret=0; bool cleanup = false; /* parse command-line options */ while ((opt = getopt(argc, argv, "hc")) != -1) { switch (opt) { case 'c': cleanup = true; break; case 'h': default: usage(); break; } } setlinebuf(stdout); argv += optind; argc -= optind; hsm_init(); if (cleanup) { hsm_cleanup_tokens(dmapi.sid, DM_RESP_CONTINUE, 0); if (argc == 0) { return 0; } } signal(SIGTERM, hsm_term_handler); signal(SIGINT, hsm_term_handler); if (argc == 0) { usage(); } for (i=0;i<argc;i++) { ret |= hsm_migrate(argv[i]); } return ret; }