// Kajal: This function is run in a while loop. // Basically, the state-machine for: // PRE-INIT // FINAL-INIT // RUNNING STATE // is managed from here static int c_thread_run(void *ctx) { struct c_cmn_ctx *cmn_ctx = ctx; switch (cmn_ctx->thread_type) { case THREAD_MAIN: // Kajal: First is PRE-INIT, FINAL-INIT, RUNNING // This is the main ctx. return c_main_thread_run(ctx); // With this design change, the worker threads are not needed any longer // case THREAD_WORKER: // return c_worker_thread_run(ctx); // Kajal: We will think about VTY and APP threads later. case THREAD_VTY: return c_vty_thread_run(ctx); case THREAD_APP: return c_app_thread_run(ctx); default: break; } return 0; }
static int c_thread_run(void *ctx) { struct c_cmn_ctx *cmn_ctx = ctx; switch (cmn_ctx->thread_type) { case THREAD_MAIN: return c_main_thread_run(ctx); case THREAD_WORKER: return c_worker_thread_run(ctx); case THREAD_VTY: return c_vty_thread_run(ctx); case THREAD_APP: return c_app_thread_run(ctx); default: break; } return 0; }