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


C++ DONE函数代码示例

本文整理汇总了C++中DONE函数的典型用法代码示例。如果您正苦于以下问题:C++ DONE函数的具体用法?C++ DONE怎么用?C++ DONE使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


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

示例1: MODULE_ERR

int
MODULE_ERR(Char *S)
{
   perror(S);
   if(fprintf(__Message_File, "*** Fatal Error ***  %s\n", S) < 0) {
     perror("MODULE_ERR: fprintf: ");
     DONE();
   }
   DONE();
   return 1;

}
开发者ID:juddy,项目名称:edcde,代码行数:12,代码来源:qalib.c

示例2: main

int
main(int argc, char *argv[])
{
	START(argc, argv, "obj_pool_lock");

	if (argc < 2)
		UT_FATAL("usage: %s path", argv[0]);

	if (argc == 2) {
		test_reopen(argv[1]);

		test_open_in_different_process(argc, argv, 0);
		for (int i = 1; i < 100000; i *= 2)
			test_open_in_different_process(argc, argv, i);
	} else if (argc == 3) {
		PMEMobjpool *pop;
		/* 2nd arg used by windows for 2 process test */
		pop = pmemobj_open(argv[1], LAYOUT);
		if (pop)
			UT_FATAL("pmemobj_open after create process should "
				"not succeed");

		if (errno != EWOULDBLOCK)
			UT_FATAL("!pmemobj_open after create process failed "
				"but for unexpected reason");
	}

	DONE(NULL);
}
开发者ID:mramotowski,项目名称:nvml,代码行数:29,代码来源:obj_pool_lock.c

示例3: main

int
main(int argc, char *argv[])
{
	START(argc, argv, "util_poolset_parse");

	out_init(LOG_PREFIX, LOG_LEVEL_VAR, LOG_FILE_VAR,
			MAJOR_VERSION, MINOR_VERSION);

	if (argc < 2)
		FATAL("usage: %s set-file-name ...", argv[0]);

	struct pool_set *set;
	int fd;

	for (int i = 1; i < argc; i++) {
		const char *path = argv[i];

		fd = OPEN(path, O_RDWR);

		int ret = util_poolset_parse(path, fd, &set);
		if (ret == 0)
			util_poolset_free(set);

		CLOSE(fd);
	}

	out_fini();

	DONE(NULL);
}
开发者ID:Skyprophet,项目名称:peloton,代码行数:30,代码来源:util_poolset_parse.c

示例4: log

void tagTab::updateCheckboxes()
{
	log(tr("Mise à jour des cases à cocher."));
	qDeleteAll(m_checkboxes);
	m_checkboxes.clear();
	QStringList urls = m_sites->keys();
	QSettings settings(savePath("settings.ini"), QSettings::IniFormat, this);
	int n = settings.value("Sources/Letters", 3).toInt(), m = n;
	for (int i = 0; i < urls.size(); i++)
	{
		if (urls[i].startsWith("www."))
		{ urls[i] = urls[i].right(urls[i].length() - 4); }
		else if (urls[i].startsWith("chan."))
		{ urls[i] = urls[i].right(urls[i].length() - 5); }
		if (n < 0)
		{
			m = urls.at(i).indexOf('.');
			if (n < -1 && urls.at(i).indexOf('.', m+1) != -1)
			{ m = urls.at(i).indexOf('.', m+1); }
		}

		bool isChecked = m_selectedSources.size() > i ? m_selectedSources.at(i) : false;
		QCheckBox *c = new QCheckBox(urls.at(i).left(m), this);
			c->setChecked(isChecked);
			ui->layoutSourcesList->addWidget(c);

		m_checkboxes.append(c);
	}
	DONE();
}
开发者ID:larry-he,项目名称:imgbrd-grabber,代码行数:30,代码来源:tag-tab.cpp

示例5: main

int
main(int argc, char *argv[])
{
	START(argc, argv, "util_map_proc");

	util_init();

	if (argc < 3)
		UT_FATAL("usage: %s maps_file len [len]...", argv[0]);

	Sfile = argv[1];

	for (int arg = 2; arg < argc; arg++) {
		size_t len = (size_t)strtoull(argv[arg], NULL, 0);

		size_t align = Ut_pagesize;
		if (len >= 2 * GIGABYTE)
			align = GIGABYTE;
		else if (len >= 4 * MEGABYTE)
			align = 2 * MEGABYTE;

		void *h1 =
			util_map_hint_unused((void *)TERABYTE, len, GIGABYTE);
		void *h2 = util_map_hint(len, 0);
		if (h1 != MAP_FAILED && h1 != NULL)
			UT_ASSERTeq((uintptr_t)h1 & (GIGABYTE - 1), 0);
		if (h2 != MAP_FAILED && h2 != NULL)
			UT_ASSERTeq((uintptr_t)h2 & (align - 1), 0);
		UT_OUT("len %zu: %p %p", len, h1, h2);
	}

	DONE(NULL);
}
开发者ID:AmesianX,项目名称:nvml,代码行数:33,代码来源:util_map_proc.c

示例6: main

int
main(int argc, char *argv[])
{
	const int test_value = 123456;
	int count = DEFAULT_COUNT;
	int n = DEFAULT_N;
	int *ptr;
	int i, j;

	START(argc, argv, "vmmalloc_calloc");

	for (i = 0; i < n; i++) {
		ptr = calloc(1, count * sizeof(int));
		UT_ASSERTne(ptr, NULL);

		/* calloc should return zeroed memory */
		for (j = 0; j < count; j++)
			UT_ASSERTeq(ptr[j], 0);
		for (j = 0; j < count; j++)
			ptr[j] = test_value;
		for (j = 0; j < count; j++)
			UT_ASSERTeq(ptr[j], test_value);

		cfree(ptr);
	}

	DONE(NULL);
}
开发者ID:GBuella,项目名称:nvml,代码行数:28,代码来源:vmmalloc_calloc.c

示例7: main

int
main(int argc, char *argv[])
{
	START(argc, argv, "obj_out_of_memory");

	if (argc < 3)
		FATAL("usage: %s size filename ...", argv[0]);

	size_t size = atoll(argv[1]);

	for (int i = 2; i < argc; i++) {
		const char *path = argv[i];

		PMEMobjpool *pop = pmemobj_create(path, LAYOUT_NAME, 0,
					S_IWUSR | S_IRUSR);
		if (pop == NULL)
			FATAL("!pmemobj_create: %s", path);

		test_alloc(pop, size);

		pmemobj_close(pop);

		ASSERTeq(pmemobj_check(path, LAYOUT_NAME), 1);

		ASSERTne(pop = pmemobj_open(path, LAYOUT_NAME), NULL);

		test_free(pop);

		pmemobj_close(pop);
	}

	DONE(NULL);
}
开发者ID:Skyprophet,项目名称:peloton,代码行数:33,代码来源:obj_out_of_memory.c

示例8: main

int
main(int argc, char *argv[])
{
	char *dir = NULL;
	void *mem_pool = NULL;
	VMEM *vmp;

	START(argc, argv, "vmem_check");

	if (argc == 2) {
		dir = argv[1];
	} else if (argc > 2) {
		FATAL("usage: %s [directory]", argv[0]);
	}

	if (dir == NULL) {
		/* allocate memory for function vmem_create_in_region() */
		mem_pool = MMAP(NULL, VMEM_MIN_POOL*2, PROT_READ|PROT_WRITE,
					MAP_ANONYMOUS|MAP_PRIVATE, -1, 0);

		vmp = vmem_create_in_region(mem_pool, VMEM_MIN_POOL);
		if (vmp == NULL)
			FATAL("!vmem_create_in_region");
	} else {
		vmp = vmem_create(dir, VMEM_MIN_POOL);
		if (vmp == NULL)
			FATAL("!vmem_create");
	}

	ASSERTeq(1, vmem_check(vmp));

	/* create pool in this same memory region */
	if (dir == NULL) {
		unsigned long Pagesize = (unsigned long) sysconf(_SC_PAGESIZE);
		void *mem_pool2 = (void *)(((uintptr_t)mem_pool +
			VMEM_MIN_POOL/2) & ~(Pagesize-1));

		VMEM *vmp2 = vmem_create_in_region(mem_pool2,
			VMEM_MIN_POOL);

		if (vmp2 == NULL)
			FATAL("!vmem_create_in_region");

		/* detect memory range collision */
		ASSERTne(1, vmem_check(vmp));
		ASSERTne(1, vmem_check(vmp2));

		vmem_delete(vmp2);

		ASSERTne(1, vmem_check(vmp2));
	}

	vmem_delete(vmp);

	/* for vmem_create() memory unmapped after delete pool */
	if (!dir)
		ASSERTne(1, vmem_check(vmp));

	DONE(NULL);
}
开发者ID:KaiZhang666,项目名称:nvml,代码行数:60,代码来源:vmem_check.c

示例9: main

int
main(int argc, char *argv[])
{
	START(argc, argv, "util_file_create");

	if (argc < 3)
		UT_FATAL("usage: %s minlen len:path...", argv[0]);

	char *fname;
	size_t minsize = strtoul(argv[1], &fname, 0);

	for (int arg = 2; arg < argc; arg++) {
		size_t size = strtoul(argv[arg], &fname, 0);
		if (*fname != ':')
			UT_FATAL("usage: %s minlen len:path...", argv[0]);
		fname++;

		int fd;
		if ((fd = util_file_create(fname, size, minsize)) == -1)
			UT_OUT("!%s: util_file_create", fname);
		else {
			UT_OUT("%s: created", fname);
			close(fd);
		}
	}

	DONE(NULL);
}
开发者ID:ChandKV,项目名称:nvml,代码行数:28,代码来源:util_file_create.c

示例10: pool_test

/*
 * pool_test -- test pool
 *
 * This function creates a memory pool in a file (if dir is not NULL),
 * or in RAM (if dir is NULL) and allocates memory for the test.
 */
void
pool_test(const char *dir)
{
	VMEM *vmp = NULL;

	if (dir != NULL) {
		vmp = vmem_pool_create(dir, VMEM_MIN_POOL);
	} else {
		vmp = vmem_pool_create_in_region(mem_pool, VMEM_MIN_POOL);
	}

	if (expect_create_pool == 0) {
		ASSERTeq(vmp, NULL);
		DONE(NULL);
	} else {
		if (vmp == NULL) {
			if (dir == NULL) {
				FATAL("!vmem_pool_create_in_region");
			} else {
				FATAL("!vmem_pool_create");
			}
		}
	}

	char *test = vmem_malloc(vmp, strlen(TEST_STRING_VALUE) + 1);
	ASSERTne(test, NULL);

	strcpy(test, TEST_STRING_VALUE);
	ASSERTeq(strcmp(test, TEST_STRING_VALUE), 0);

	vmem_free(vmp, test);

	vmem_pool_delete(vmp);
}
开发者ID:andyrudoff,项目名称:nvml-build,代码行数:40,代码来源:vmem_custom_alloc.c

示例11: main

int
main(int argc, char *argv[])
{
	VMEM *vmp;

	START(argc, argv, "vmem_create_error");

	if (argc > 1)
		UT_FATAL("usage: %s", argv[0]);

	errno = 0;
	vmp = vmem_create_in_region(mem_pool, 0);
	UT_ASSERTeq(vmp, NULL);
	UT_ASSERTeq(errno, EINVAL);

	errno = 0;
	vmp = vmem_create("./", 0);
	UT_ASSERTeq(vmp, NULL);
	UT_ASSERTeq(errno, EINVAL);

	errno = 0;
	vmp = vmem_create("invalid dir [email protected]#$%^&*()=", VMEM_MIN_POOL);
	UT_ASSERTeq(vmp, NULL);
	UT_ASSERTne(errno, 0);

	DONE(NULL);
}
开发者ID:ChandKV,项目名称:nvml,代码行数:27,代码来源:vmem_create_error.c

示例12: main

int
main(int argc, char *argv[])
{
	START(argc, argv, "obj_pool");

	if (argc < 4)
		UT_FATAL("usage: %s op path layout [poolsize mode]", argv[0]);

	char *layout = NULL;
	size_t poolsize;
	unsigned mode;

	if (strcmp(argv[3], "EMPTY") == 0)
		layout = "";
	else if (strcmp(argv[3], "NULL") != 0)
		layout = argv[3];

	switch (argv[1][0]) {
	case 'c':
		poolsize = strtoul(argv[4], NULL, 0) * MB; /* in megabytes */
		mode = strtoul(argv[5], NULL, 8);

		pool_create(argv[2], layout, poolsize, mode);
		break;

	case 'o':
		pool_open(argv[2], layout);
		break;

	default:
		UT_FATAL("unknown operation");
	}

	DONE(NULL);
}
开发者ID:AmesianX,项目名称:nvml,代码行数:35,代码来源:obj_pool.c

示例13: main

int
main(int argc, char *argv[])
{
	START(argc, argv, "win_mmap");

	if (argc !=  2)
		UT_FATAL("usage: %s file", argv[0]);

	int fd = OPEN(argv[1], O_RDWR);
	int fd_ro = OPEN(argv[1], O_RDONLY);

	POSIX_FALLOCATE(fd, 0, FILE_SIZE);

	test_mmap_flags(fd);
	test_mmap_len(fd);
	test_mmap_hint(fd);
	test_mmap_fixed(fd);
	test_mmap_anon(fd);
	test_mmap_shared(fd);
	test_mmap_prot(fd, fd_ro);
	test_mmap_prot_anon();
	test_munmap(fd);
	test_msync(fd);
	test_mprotect(fd, fd_ro);
	test_mprotect_anon();

	CLOSE(fd_ro);
	CLOSE(fd);

	DONE(NULL);
}
开发者ID:tomaszkapela,项目名称:nvml,代码行数:31,代码来源:win_mmap.c

示例14: main

int
main(int argc, char *argv[])
{
	START(argc, argv, "obj_cpp_cond_var");

	if (argc != 2)
		UT_FATAL("usage: %s file-name", argv[0]);

	const char *path = argv[1];

	nvobj::pool<struct root> pop;

	try {
		pop = nvobj::pool<struct root>::create(
			path, LAYOUT, PMEMOBJ_MIN_POOL, S_IWUSR | S_IRUSR);
	} catch (pmem::pool_error &pe) {
		UT_FATAL("!pool::create: %s %s", pe.what(), path);
	}

	cond_zero_test(pop);

	std::vector<reader_type> notify_functions(
		{reader_mutex, reader_mutex_pred, reader_lock, reader_lock_pred,
		 reader_mutex_until, reader_mutex_until_pred, reader_lock_until,
		 reader_lock_until_pred, reader_mutex_for,
		 reader_mutex_for_pred, reader_lock_for, reader_lock_for_pred});

	for (auto func : notify_functions) {
		int reset_value = 42;

		mutex_test(pop, true, false, write_notify, func);
		pop.get_root()->counter = reset_value;

		mutex_test(pop, true, true, write_notify, func);
		pop.get_root()->counter = reset_value;
	}

	std::vector<reader_type> not_notify_functions(
		{reader_mutex_until, reader_mutex_until_pred, reader_lock_until,
		 reader_lock_until_pred, reader_mutex_for,
		 reader_mutex_for_pred, reader_lock_for, reader_lock_for_pred});

	for (auto func : not_notify_functions) {
		int reset_value = 42;

		mutex_test(pop, false, false, write_notify, func);
		pop.get_root()->counter = reset_value;

		mutex_test(pop, false, true, write_notify, func);
		pop.get_root()->counter = reset_value;
	}

	/* pmemcheck related persist */
	pmemobj_persist(pop.get_handle(), &(pop.get_root()->counter),
			sizeof(pop.get_root()->counter));

	pop.close();

	DONE(nullptr);
}
开发者ID:wojtuss,项目名称:nvml,代码行数:60,代码来源:obj_cpp_cond_var.cpp

示例15: main

int
main(int argc, char *argv[])
{
	START(argc, argv, "obj_pmalloc_oom_mt");

	if (argc != 2)
		FATAL("usage: %s file-name", argv[0]);

	const char *path = argv[1];

	if ((pop = pmemobj_create(path, LAYOUT_NAME,
			PMEMOBJ_MIN_POOL, S_IWUSR | S_IRUSR)) == NULL)
		FATAL("!pmemobj_create: %s", path);

	pthread_t t;
	pthread_create(&t, NULL, oom_worker, NULL);
	pthread_join(t, NULL);

	int first_thread_allocated = allocated;

	pthread_create(&t, NULL, oom_worker, NULL);
	pthread_join(t, NULL);

	ASSERTeq(first_thread_allocated, allocated);

	pmemobj_close(pop);

	DONE(NULL);
}
开发者ID:Neuvenen,项目名称:nvml,代码行数:29,代码来源:obj_pmalloc_oom_mt.c


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