本文整理汇总了C++中MsgDistributor::init方法的典型用法代码示例。如果您正苦于以下问题:C++ MsgDistributor::init方法的具体用法?C++ MsgDistributor::init怎么用?C++ MsgDistributor::init使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MsgDistributor
的用法示例。
在下文中一共展示了MsgDistributor::init方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: main
int main(int argc, char *argv[])
{
int src_GUID = -1, dst_GUID = -1;
/* parameter parsing */
while(1) {
int option_index = 0, c = 0;
static struct option long_options[] =
{
{"h", no_argument, 0, 0},
{"help", no_argument, 0, 0},
{"v", no_argument, 0, 0},
{"version", no_argument, 0, 0},
{"orbit", no_argument, 0, 0},
{"d", no_argument, 0, 0},
{"m", required_argument, 0, 0},
{"o", required_argument, 0, 0},
{"storm", no_argument, 0, 0},
{"train", no_argument, 0, 0},
{0, 0, 0, 0}
};
c = getopt_long_only(argc, argv, "", long_options, &option_index);
/* no more options to parse */
if(c == -1) break;
/* unrecognized option */
if(c == '?')
{
help();
return 0;
}
switch(option_index)
{
/* h, help */
case 0:
case 1:
help();
return 0;
break;
/* v, version */
case 2:
case 3:
printf("Real-Time CPS Server Version: 0.1\n" \
"Compilation Date.....: unknown\n" \
"Compilation Time.....: unknown\n");
return 0;
break;
/* orbit, run in orbit mode */
case 4:
orbit = 1;
break;
/* debug mode */
case 5:
debug = 1;
break;
/* mine GUID */
case 6:
src_GUID = strtol(optarg, NULL, 10);
break;
/* other's GUID */
case 7:
dst_GUID = strtol(optarg, NULL, 10);
break;
/* storm mode */
case 8:
storm = 1;
break;
/* train mode */
case 9:
train = 1;
break;
default:
help();
return 0;
}
}
if (!orbit)
{
/* register signal handler for <CTRL>+C in order to clean up */
if(signal(SIGINT, signal_handler) == SIG_ERR)
{
printf("could not register signal handler\n");
exit(EXIT_FAILURE);
}
}
// init the mutex lock
if (pthread_mutex_init(&user_map_lock, NULL) != 0
//.........这里部分代码省略.........