本文整理汇总了C++中SetLatch函数的典型用法代码示例。如果您正苦于以下问题:C++ SetLatch函数的具体用法?C++ SetLatch怎么用?C++ SetLatch使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了SetLatch函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: sighupHandler
/*
* Signal handler for SIGHUP
*
* Used only in BufferSaver. Set a flag to notify the main loop of the signal
* received, and set our latch to wake it up.
*/
static void
sighupHandler(SIGNAL_ARGS)
{
got_sighup = true;
if (MyProc)
SetLatch(&MyProc->procLatch);
}
示例2: logicalrep_worker_wakeup_ptr
/*
* Wake up (using latch) the specified logical replication worker.
*
* Caller must hold lock, else worker->proc could change under us.
*/
void
logicalrep_worker_wakeup_ptr(LogicalRepWorker *worker)
{
Assert(LWLockHeldByMe(LogicalRepWorkerLock));
SetLatch(&worker->proc->procLatch);
}
示例3: ProcSendSignal
/*
* ProcSendSignal - send a signal to a backend identified by PID
*/
void
ProcSendSignal(int pid)
{
PGPROC *proc = NULL;
if (RecoveryInProgress())
{
/* use volatile pointer to prevent code rearrangement */
volatile PROC_HDR *procglobal = ProcGlobal;
SpinLockAcquire(ProcStructLock);
/*
* Check to see whether it is the Startup process we wish to signal.
* This call is made by the buffer manager when it wishes to wake up a
* process that has been waiting for a pin in so it can obtain a
* cleanup lock using LockBufferForCleanup(). Startup is not a normal
* backend, so BackendPidGetProc() will not return any pid at all. So
* we remember the information for this special case.
*/
if (pid == procglobal->startupProcPid)
proc = procglobal->startupProc;
SpinLockRelease(ProcStructLock);
}
if (proc == NULL)
proc = BackendPidGetProc(pid);
if (proc != NULL)
{
SetLatch(&proc->procLatch);
}
}
示例4: ProcWakeup
/*
* ProcWakeup -- wake up a process by releasing its private___ semaphore.
*
* Also remove the process from the wait queue and set its links invalid.
* RETURN: the next process in the wait queue.
*
* The appropriate lock partition lock must be held by caller.
*
* XXX: presently, this code is only used for the "success" case, and only
* works correctly for that case. To clean up in failure case, would need
* to twiddle the lock's request counts too --- see RemoveFromWaitQueue.
* Hence, in practice the waitStatus parameter must be STATUS_OK.
*/
PGPROC *
ProcWakeup(PGPROC *proc, int waitStatus)
{
PGPROC *retProc;
/* Proc should be sleeping ... */
if (proc->links.prev == NULL ||
proc->links.next == NULL)
return NULL;
Assert(proc->waitStatus == STATUS_WAITING);
/* Save next process before we zap the list link */
retProc = (PGPROC *) proc->links.next;
/* Remove process from wait queue */
SHMQueueDelete(&(proc->links));
(proc->waitLock->waitProcs.size)--;
/* Clean up process' state and pass it the ok/fail signal */
proc->waitLock = NULL;
proc->waitProcLock = NULL;
proc->waitStatus = waitStatus;
/* And awaken it */
SetLatch(&proc->procLatch);
return retProc;
}
示例5: WalSndLastCycleHandler
/* SIGUSR2: set flag to do a last cycle and shut down afterwards */
static void
WalSndLastCycleHandler(SIGNAL_ARGS)
{
ready_to_stop = true;
if (MyWalSnd)
SetLatch(&MyWalSnd->latch);
}
示例6: worker_spi_sighup
static void
worker_spi_sighup(SIGNAL_ARGS)
{
elog(LOG, "got sighup");
if (MyProc)
SetLatch(&MyProc->procLatch);
}
示例7: WalSndSigHupHandler
/* SIGHUP: set flag to re-read config file at next convenient time */
static void
WalSndSigHupHandler(SIGNAL_ARGS)
{
got_SIGHUP = true;
if (MyWalSnd)
SetLatch(&MyWalSnd->latch);
}
示例8: WalSndShutdownHandler
/* SIGTERM: set flag to shut down */
static void
WalSndShutdownHandler(SIGNAL_ARGS)
{
shutdown_requested = true;
if (MyWalSnd)
SetLatch(&MyWalSnd->latch);
}
示例9: pg_keeper_sighup
/*
* Signal handler for SIGHUP
* Set a flag to let the main loop to reread the config file, and set
* our latch to wake it up.
*/
static void
pg_keeper_sighup(SIGNAL_ARGS)
{
got_sighup = true;
if (MyProc)
SetLatch(&MyProc->procLatch);
}
示例10: IdleInTransactionSessionTimeoutHandler
static void
IdleInTransactionSessionTimeoutHandler(void)
{
IdleInTransactionSessionTimeoutPending = true;
InterruptPending = true;
SetLatch(MyLatch);
}
示例11: terminate_group
static void
terminate_group(ContQueryProcGroup *grp)
{
bool found;
int i;
grp->active = true;
for (i = 0; i < TOTAL_SLOTS; i++)
{
ContQueryProc *proc = &grp->procs[i];
/* Wake up processes, so they can see the terminate flag. */
SetLatch(proc->latch);
/* Let workers crash now as well in case we force terminate them. */
ChangeBackgroundWorkerRestartState(&proc->handle, true, 0);
}
/* Wait for a bit and then force terminate any processes that are still alive. */
pg_usleep(Max(ContQuerySchedulerShmem->params.max_wait, MIN_WAIT_TERMINATE_MS) * 1000);
for (i = 0; i < TOTAL_SLOTS; i++)
{
ContQueryProc *proc = &grp->procs[i];
TerminateBackgroundWorker(&proc->handle);
}
hash_search(ContQuerySchedulerShmem->proc_table, &grp->db_oid, HASH_REMOVE, &found);
Assert(found);
TupleBufferDrain(WorkerTupleBuffer, grp->db_oid);
TupleBufferDrain(CombinerTupleBuffer, grp->db_oid);
}
示例12: ArchSigHupHandler
/* SIGHUP signal handler for archiver process */
static void
ArchSigHupHandler(SIGNAL_ARGS)
{
/* set flag to re-read config file at next convenient time */
got_SIGHUP = true;
/* let the waiting loop iterate */
SetLatch(&mainloop_latch);
}
示例13: hello_sighup
static void
hello_sighup(SIGNAL_ARGS)
{
int save_errno = errno;
got_sighup = true;
SetLatch(MyLatch);
errno = save_errno;
}
示例14: pgarch_waken
/* SIGUSR1 signal handler for archiver process */
static void
pgarch_waken(SIGNAL_ARGS)
{
/* set flag that there is work to be done */
wakened = true;
/* let the waiting loop iterate */
SetLatch(&mainloop_latch);
}
示例15: WalSndWakeup
/* Wake up all walsenders */
void
WalSndWakeup(void)
{
int i;
for (i = 0; i < max_wal_senders; i++)
SetLatch(&WalSndCtl->walsnds[i].latch);
}