本文整理汇总了C++中DB_ENV::memp_trickle方法的典型用法代码示例。如果您正苦于以下问题:C++ DB_ENV::memp_trickle方法的具体用法?C++ DB_ENV::memp_trickle怎么用?C++ DB_ENV::memp_trickle使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DB_ENV
的用法示例。
在下文中一共展示了DB_ENV::memp_trickle方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: return
static void *bdb_mempool_trickle_thread(void *arg){
DB_ENV *dbenv;
int ret, nwrotep;
dbenv = arg;
for (;; sleep(bdb_settings.mempool_trickle_val)) {
if ((ret = dbenv->memp_trickle(dbenv, bdb_settings.mempool_trickle_percent, &nwrotep)) != 0) {
dbenv->err(dbenv, ret, "mempool_trickle thread");
}
dbenv->errx(dbenv, "mempool_trickle thread: writing %d dirty pages", nwrotep);
}
return (NULL);
}
示例2:
static void *
bdb_tool_trickle_task( void *ctx, void *ptr )
{
DB_ENV *env = ptr;
int wrote;
ldap_pvt_thread_mutex_lock( &bdb_tool_trickle_mutex );
while ( 1 ) {
ldap_pvt_thread_cond_wait( &bdb_tool_trickle_cond,
&bdb_tool_trickle_mutex );
if ( slapd_shutdown )
break;
env->memp_trickle( env, 30, &wrote );
}
ldap_pvt_thread_mutex_unlock( &bdb_tool_trickle_mutex );
return NULL;
}
示例3: return
static void *bdb_memp_trickle_thread(void *arg)
{
DB_ENV *dbenv;
int ret, nwrotep;
dbenv = arg;
if (settings.verbose > 1) {
dbenv->errx(dbenv, "memp_trickle thread created: %lu, every %d seconds, %d%% pages should be clean.",
(u_long)pthread_self(), bdb_settings.memp_trickle_val,
bdb_settings.memp_trickle_percent);
}
for (;; sleep(bdb_settings.memp_trickle_val)) {
if ((ret = dbenv->memp_trickle(dbenv, bdb_settings.memp_trickle_percent, &nwrotep)) != 0) {
dbenv->err(dbenv, ret, "memp_trickle thread");
}
dbenv->errx(dbenv, "memp_trickle thread: writing %d dirty pages", nwrotep);
}
return (NULL);
}
示例4: strerror
void *
trickle_thread(void *arg)
{
DB_ENV *dbenv;
int ret;
int my_pid = (int)getpid();
dbenv = arg;
if(init_log(my_pid))
{
exit(1);
}
write_log("TRICKLE %d: starting\n", my_pid);
/* Trickle every 5 seconds. */
for (;; poll(0,0,5000))
{
int nwritten = 0;
switch (ret = dbenv->memp_trickle(dbenv, CLEAN_PERCENT, &nwritten))
{
case 0:
write_log("TRICKLE %d: write %d pages\n", my_pid, nwritten);
break;
default:
write_log("TRICKLE %d: trickle error - %s\n",
my_pid, db_strerror(ret));
break;
}
if(pthread_mutex_lock(&trickle_mutex))
{
write_log("TRICKLE %d: pthread_mutex_lock error - %s\n",
my_pid, strerror(errno));
goto error;
}
if(trickle_exit_flag)
{
/* The thread was told to exit */
if(pthread_mutex_unlock(&trickle_mutex))
{
write_log("TRICKLE %d: pthread_mutex_unlock error - %s\n",
my_pid, strerror(errno));
goto error;
}
write_log("TRICKLE %d: exiting gracefully\n", my_pid);
goto done;
}
if(pthread_mutex_unlock(&trickle_mutex))
{
write_log("TRICKLE %d: pthread_mutex_unlock error - %s\n",
my_pid, strerror(errno));
goto error;
}
}
error:
write_log("TRICKLE %d: exiting from ERROR\n", my_pid);
done:
return (void *)0;
}