• Home
  • History
  • Annotate
  • Raw
  • Download
  • only in /netgear-R7000-V1.0.7.12_1.2.5/ap/gpl/timemachine/db-4.7.25.NC/repmgr/

Lines Matching refs:db_rep

112  * Caller must hold the db_rep->mutex, if this thread synchronization is to work
136 DB_REP *db_rep;
140 db_rep = env->rep_handle;
142 if ((timed = (db_rep->ack_timeout > 0)))
144 db_rep->ack_timeout);
150 ret = pthread_cond_timedwait(&db_rep->ack_condition,
151 &db_rep->mutex, &deadline);
153 ret = pthread_cond_wait(&db_rep->ack_condition,
154 &db_rep->mutex);
155 if (db_rep->finished)
222 DB_REP *db_rep;
226 db_rep = env->rep_handle;
233 &db_rep->mutex, &deadline);
236 if (db_rep->finished)
295 __repmgr_init_sync(env, db_rep)
297 DB_REP *db_rep;
306 if ((ret = pthread_mutex_init(&db_rep->mutex, NULL)) != 0)
310 if ((ret = pthread_cond_init(&db_rep->ack_condition, NULL)) != 0)
314 if ((ret = pthread_cond_init(&db_rep->check_election, NULL)) != 0)
318 if ((ret = pthread_cond_init(&db_rep->queue_nonempty, NULL)) != 0)
327 db_rep->read_pipe = file_desc[0];
328 db_rep->write_pipe = file_desc[1];
332 (void)pthread_cond_destroy(&db_rep->queue_nonempty);
334 (void)pthread_cond_destroy(&db_rep->check_election);
336 (void)pthread_cond_destroy(&db_rep->ack_condition);
338 (void)pthread_mutex_destroy(&db_rep->mutex);
339 db_rep->read_pipe = db_rep->write_pipe = -1;
354 DB_REP *db_rep;
357 db_rep = env->rep_handle;
359 if (!(REPMGR_SYNC_INITED(db_rep)))
362 ret = pthread_cond_destroy(&db_rep->queue_nonempty);
364 if ((t_ret = pthread_cond_destroy(&db_rep->check_election)) != 0 &&
368 if ((t_ret = pthread_cond_destroy(&db_rep->ack_condition)) != 0 &&
372 if ((t_ret = pthread_mutex_destroy(&db_rep->mutex)) != 0 &&
376 if (close(db_rep->read_pipe) == -1 && ret == 0)
378 if (close(db_rep->write_pipe) == -1 && ret == 0)
381 db_rep->read_pipe = db_rep->write_pipe = -1;
387 * and allocation. A valid db_rep->listen_fd acts as the "all-or-nothing"
393 __repmgr_net_init(env, db_rep)
395 DB_REP *db_rep;
416 if ((db_rep->chg_sig_handler = (sigact.sa_handler == SIG_DFL))) {
428 (void)closesocket(db_rep->listen_fd);
429 db_rep->listen_fd = INVALID_SOCKET;
475 DB_REP *db_rep;
479 db_rep = env->rep_handle;
486 if (write(db_rep->write_pipe, &any_value, 1) == -1)
535 DB_REP *db_rep;
544 db_rep = env->rep_handle;
550 LOCK_MUTEX(db_rep->mutex);
561 FD_SET((u_int)db_rep->listen_fd, &reads);
562 maxfd = db_rep->listen_fd;
564 FD_SET((u_int)db_rep->read_pipe, &reads);
565 if (db_rep->read_pipe > maxfd)
566 maxfd = db_rep->read_pipe;
577 for (conn = TAILQ_FIRST(&db_rep->connections);
623 UNLOCK_MUTEX(db_rep->mutex);
630 LOCK_MUTEX(db_rep->mutex);
637 LOCK_MUTEX(db_rep->mutex);
651 TAILQ_FOREACH(conn, &db_rep->connections, entries) {
665 if (FD_ISSET((u_int)db_rep->read_pipe, &reads)) {
666 if (read(db_rep->read_pipe, buf, sizeof(buf)) <= 0) {
669 } else if (db_rep->finished) {
677 if (FD_ISSET((u_int)db_rep->listen_fd, &reads) &&
682 UNLOCK_MUTEX(db_rep->mutex);
723 DB_REP *db_rep;
743 db_rep = env->rep_handle;
754 STAT(db_rep->region->mstat.st_connect_fail++);