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


C++ DB_ENV::errx方法代码示例

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


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

示例1:

void *
logfile_thread(void *arg)
{
	DB_ENV *dbenv;
	int ret;
	char **begin, **list;

	dbenv = arg;
	dbenv->errx(dbenv,
	    "Log file removal thread: %lu", (u_long)pthread_self());

	/* Check once every 5 minutes. */
	for (;; sleep(300)) {
		/* Get the list of log files. */
		if ((ret =
		    dbenv->log_archive(dbenv, &list, DB_ARCH_ABS)) != 0) {
			dbenv->err(dbenv, ret, "DB_ENV->log_archive");
			exit (1);
		}

		/* Remove the log files. */
		if (list != NULL) {
			for (begin = list; *list != NULL; ++list)
				if ((ret = remove(*list)) != 0) {
					dbenv->err(dbenv,
					    ret, "remove %s", *list);
					exit (1);
				}
			free (begin);
		}
	}
	/* NOTREACHED */
}
开发者ID:Zhoutall,项目名称:stasis,代码行数:33,代码来源:bdbHash.c

示例2: return

static void *bdb_chkpoint_thread(void *arg)
{
    DB_ENV *dbenv;
    int ret;
    dbenv = arg;
    if (settings.verbose > 1) {
        dbenv->errx(dbenv, "checkpoint thread created: %lu, every %d seconds", 
                           (u_long)pthread_self(), bdb_settings.chkpoint_val);
    }
    for (;; sleep(bdb_settings.chkpoint_val)) {
        if ((ret = dbenv->txn_checkpoint(dbenv, 0, 0, 0)) != 0) {
            dbenv->err(dbenv, ret, "checkpoint thread");
        }
        dbenv->errx(dbenv, "checkpoint thread: a txn_checkpoint is done");
    }
    return (NULL);
}
开发者ID:LMDB,项目名称:memcachedb,代码行数:17,代码来源:bdb.c

示例3: return

static void *bdb_qstats_dump_thread(void *arg){
    DB_ENV *dbenv;
    int ret;
    dbenv = arg;
    for (;; sleep(bdb_settings.qstats_dump_val)) {
        dump_qstats_to_db();
        dbenv->errx(dbenv, "qstats dump thread: a qstats is dump.");
    }
    return (NULL);
}
开发者ID:lazywalker,项目名称:memcacheq,代码行数:10,代码来源:bdb.c

示例4: while

static void *bdb_dl_detect_thread(void *arg)
{
    DB_ENV *dbenv;
    struct timeval t;
    dbenv = arg;
    if (settings.verbose > 1) {
        dbenv->errx(dbenv, "deadlock detecting thread created: %lu, every %d millisecond",
                    (u_long)pthread_self(), bdb_settings.dldetect_val);
    }
    while (!daemon_quit) {
        t.tv_sec = bdb_settings.dldetect_val / 1000000;
        t.tv_usec = bdb_settings.dldetect_val % 1000000;
        (void)dbenv->lock_detect(dbenv, 0, DB_LOCK_YOUNGEST, NULL);
        /* select is a more accurate sleep timer */
        if (settings.verbose > 0)
            dbenv->errx(dbenv, "deadlock detecting thread: done (daemon_quit=%d)",daemon_quit);
        (void)select(0, NULL, NULL, NULL, &t);
    }
    return (NULL);
}
开发者ID:Mons,项目名称:memcachedb,代码行数:20,代码来源:bdb.c

示例5: getopt


//.........这里部分代码省略.........
			memset(optarg, 0, strlen(optarg));
			if (passwd == NULL) {
				fprintf(stderr, "%s: strdup: %s\n",
					progname, strerror(errno));
				return (EXIT_FAILURE);
			}
			break;
		case 'R':
			Rflag = 1;
			/* DB_AGGRESSIVE requires DB_SALVAGE */
			/* FALLTHROUGH */
		case 'r':
			rflag = 1;
			break;
		case 'V':
			printf("%s\n", DbXml::dbxml_version(NULL, NULL, NULL));
			printf("%s\n", db_version(NULL, NULL, NULL));
			return (EXIT_SUCCESS);
		case '?':
		default:
			return (usage());
		}
	argc -= optind;
	argv += optind;

	if (argc != 1)
		return (usage());

	/* Handle possible interruptions. */
	SigBlock sb;

	/*
	 * Create an environment object and initialize it for error
	 * reporting.
	 */
	if ((ret = db_env_create(&dbenv, 0)) != 0) {
		fprintf(stderr,
			"%s: db_env_create: %s\n", progname, db_strerror(ret));
		goto err;
	}

	dbenv->set_errfile(dbenv, stderr);
	dbenv->set_errpfx(dbenv, progname);
	if (nflag) {
		if ((ret = dbenv->set_flags(dbenv, DB_NOLOCKING, 1)) != 0) {
			dbenv->err(dbenv, ret, "set_flags: DB_NOLOCKING");
			goto err;
		}
		if ((ret = dbenv->set_flags(dbenv, DB_NOPANIC, 1)) != 0) {
			dbenv->err(dbenv, ret, "set_flags: DB_NOPANIC");
			goto err;
		}
	}
	if (passwd != NULL && (ret = dbenv->set_encrypt(dbenv,
				     passwd, DB_ENCRYPT_AES)) != 0) {
		dbenv->err(dbenv, ret, "set_passwd");
		goto err;
	}

	/* Initialize the environment. */
	if ((ret = db_init(dbenv, home, rflag, cache, &is_private)) != 0) {
		dbenv->err(dbenv, ret, "db_init");
		goto err;
	}

	xmlDb = new XmlManager(dbenv);
	
	if (rflag) {
		try {
			xmlDb->verifyContainer(argv[0], &cout, DB_SALVAGE | (Rflag ? DB_AGGRESSIVE : 0));
		} catch (XmlException &e) {
			dbenv->errx(dbenv, "verify %s: %s", argv[0], e.what());
			goto err;
		}
		goto done;
	}
	
	try {
		xmlDb->dumpContainer(argv[0], &cout);
	} catch (XmlException &e) {
		dbenv->errx(dbenv, "dump %s: %s", argv[0], e.what());
		goto err;
	}
	
	if (0) {
	err:
		exitval = 1;
	}
done:
	if (xmlDb)
		delete xmlDb;
		
	if ((ret = dbenv->close(dbenv, 0)) != 0) {
		exitval = 1;
		fprintf(stderr,
			"%s: dbenv->close: %s\n", progname, db_strerror(ret));
	}
	
	return (exitval == 0 ? EXIT_SUCCESS : EXIT_FAILURE);
}
开发者ID:kanbang,项目名称:Colt,代码行数:101,代码来源:dbxml_dump.cpp


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