当前位置: 首页>>代码示例>>C++>>正文


C++ ZHTClient::init方法代码示例

本文整理汇总了C++中ZHTClient::init方法的典型用法代码示例。如果您正苦于以下问题:C++ ZHTClient::init方法的具体用法?C++ ZHTClient::init怎么用?C++ ZHTClient::init使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在ZHTClient的用法示例。


在下文中一共展示了ZHTClient::init方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: c_zht_init_std

int c_zht_init_std(ZHTClient_c *zhtClient, const char *zhtConfig,
		const char *neighborConf) {

#ifdef IND_MUTEX
	pthread_mutex_init(&c_zht_lookup_mutex, NULL);
	pthread_mutex_init(&c_zht_remove_mutex, NULL);
	pthread_mutex_init(&c_zht_insert_mutex, NULL);
	pthread_mutex_init(&c_zht_append_mutex, NULL);
	pthread_mutex_init(&c_zht_compare_swap_mutex, NULL);
	pthread_mutex_init(&c_zht_state_change_callback_mutex, NULL);
#elif SHARED_MUTEX
	pthread_mutex_init(&c_zht_client_mutex, NULL);
#else
#endif

	ZHTClient *zhtcppClient = new ZHTClient();

	string zhtConfigStr(zhtConfig);
	string neighborConfStr(neighborConf);

	if (zhtcppClient->init(zhtConfigStr, neighborConfStr) != 0) {

		printf("ZHTClient initialization failed, program exits.");
		return -1;
	}

	*zhtClient = (ZHTClient_c) zhtcppClient;

	return 0;
}
开发者ID:xiaobingo,项目名称:iit.datasys.zht-mpi,代码行数:30,代码来源:c_zhtclientStd.cpp

示例2: benchmark

int benchmark(string &zhtConf, string &neighborConf) {

    srand(getpid() + TimeUtil::getTime_usec());

    if (zc.init(zhtConf, neighborConf) != 0) {

        cout << "ZHTClient initialization failed, program exits." << endl;
        return -1;
    }

    init_packages();

    benchmarkInsert();

    benchmarkLookup();

    benchmarkAppend();

    benchmarkRemove();

    zc.teardown();

    return 0;

}
开发者ID:kwangiit,项目名称:SLURMPP_V2,代码行数:25,代码来源:benchmark_client.cpp

示例3: main

int main(int argc, char **argv) 
{
	extern char *optarg;

	int printHelp = 0, numThrds = 0;
	string zhtConf = "";
	string neighborConf = "";

	int c;
	while ((c = getopt(argc, argv, "z:n:t:h")) != -1) 
	{
		switch (c) 
		{
		case 'z':
			zhtConf = string(optarg);
			break;
		case 'n':
			neighborConf = string(optarg);
			break;
		case 't':
			numThrds = atoi(optarg);
			break;
		case 'h':
			printHelp = 1;
			break;
		default:
			fprintf(stderr, "Illegal argument \"%c\"\n", c);
			printUsage(argv[0]);
			exit(1);
		}
	}

	int helpPrinted = 0;
	if (printHelp) {
		printUsage(argv[0]);
		helpPrinted = 1;
	}

	try {

		if (!zhtConf.empty() && !neighborConf.empty() && numThrds != 0) {

			zc.init(zhtConf, neighborConf);
			
			cout << "Initializing Worker" << endl;
			string result;
			zc.push("temp", "test", "q1", result);
			zc.pop("xxxx", "q1", result);
			id = 1000;
			job_count = 1000;
			//test_insert();

			//test_pop();

			startWorker(numThrds);

			zc.teardown();

		} else {

			if (!helpPrinted)
				printUsage(argv[0]);
		}
	} catch (exception& e) {

		fprintf(stderr, "%s, exception caught:\n\t%s", "ZHTServer::main",
				e.what());
	}

}
开发者ID:arihant15,项目名称:CloudKonPlus,代码行数:70,代码来源:ckp_worker.cpp


注:本文中的ZHTClient::init方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。