rc_t CC KMain(int argc, char *argv[]) { static const char *help[] = { "--help", "-h", "-?", NULL }; static const char *vers[] = { "--version", "-V", NULL }; bool const has_help = has_arg(help, argc, argv); bool const has_vers = has_arg(vers, argc, argv); XMLLogger const *logger = NULL; int argfirst = 0; int arglast = 0; rc_t rc = 0; unsigned load = 0; if (has_help) { argc = 2; argv[1] = "--help"; return main_help_vers(argc, argv); } if (has_vers) { argc = 2; argv[1] = "--version"; return main_help_vers(argc, argv); } logger = make_logger(&argc, argv); memset(&G, 0, sizeof(G)); G.mode = mode_Archive; G.globalMode = mode_Archive; G.maxSeqLen = TableWriterRefSeq_MAX_SEQ_LEN; G.schemaPath = strdup(SCHEMAFILE); G.omit_aligned_reads = true; G.omit_reference_reads = true; G.minMapQual = 0; /* accept all */ G.tmpfs = strdup("/tmp"); G.cache_size = ((size_t)16) << 30; G.maxErrCount = 1000; G.minMatchCount = 10; set_pid(); for (arglast = 1; arglast < argc; ++arglast) { if (strcmp(argv[arglast], "--remap") == 0) { argv[arglast] = argv[0]; G.globalMode = mode_Remap; rc = main_1(arglast - argfirst, argv + argfirst, true, load); if (rc) break; G.mode = mode_Remap; argfirst = arglast; ++load; } } rc = main_1(arglast - argfirst, argv + argfirst, false, load); XMLLogger_Release(logger); cleanupGlobal(); return rc; }
void fill_demo_coop( so_5::coop_t & coop ) { const unsigned int producers = 40; // Shutdowner will work on the default dispatcher. coop.make_agent_with_binder< shutdowner >( so_5::create_default_disp_binder(), producers ); // Logger will work on its own context. const auto logger_mbox = make_logger( coop ); // Consumer agent must be created first. // It will work on its own working thread. auto consumer_mbox = coop.make_agent_with_binder< consumer >( so_5::disp::one_thread::create_private_disp( coop.environment() )->binder(), logger_mbox )->consumer_mbox(); // All producers will work on thread pool dispatcher. namespace tp_disp = so_5::disp::thread_pool; auto disp = tp_disp::create_private_disp( coop.environment() ); // All agents on this dispatcher will have independent event queues. const auto bind_params = tp_disp::bind_params_t{} .fifo( tp_disp::fifo_t::individual ) .max_demands_at_once( 1 ); // All producers can be created now. for( unsigned int i = 0; i != producers; ++i ) coop.make_agent_with_binder< producer >( disp->binder( bind_params ), "producer-" + std::to_string( i + 1 ), logger_mbox, consumer_mbox, 10u ); }