FreeBSD kernel kern code
kern_condvar.c File Reference
#include <sys/cdefs.h>
#include "opt_ktrace.h"
#include <sys/param.h>
#include <sys/systm.h>
#include <sys/limits.h>
#include <sys/lock.h>
#include <sys/mutex.h>
#include <sys/proc.h>
#include <sys/kernel.h>
#include <sys/ktr.h>
#include <sys/condvar.h>
#include <sys/sched.h>
#include <sys/signalvar.h>
#include <sys/sleepqueue.h>
#include <sys/resourcevar.h>
Include dependency graph for kern_condvar.c:

Go to the source code of this file.

Macros

#define CV_WAITERS_BOUND   INT_MAX
 
#define CV_WAITERS_INC(cvp)
 
#define CV_ASSERT(cvp, lock, td)
 

Functions

 __FBSDID ("$FreeBSD$")
 
void cv_init (struct cv *cvp, const char *desc)
 
void cv_destroy (struct cv *cvp)
 
void _cv_wait (struct cv *cvp, struct lock_object *lock)
 
void _cv_wait_unlock (struct cv *cvp, struct lock_object *lock)
 
int _cv_wait_sig (struct cv *cvp, struct lock_object *lock)
 
int _cv_timedwait_sbt (struct cv *cvp, struct lock_object *lock, sbintime_t sbt, sbintime_t pr, int flags)
 
int _cv_timedwait_sig_sbt (struct cv *cvp, struct lock_object *lock, sbintime_t sbt, sbintime_t pr, int flags)
 
void cv_signal (struct cv *cvp)
 
void cv_broadcastpri (struct cv *cvp, int pri)
 

Macro Definition Documentation

◆ CV_ASSERT

#define CV_ASSERT (   cvp,
  lock,
  td 
)
Value:
do { \
KASSERT((td) != NULL, ("%s: td NULL", __func__)); \
KASSERT(TD_IS_RUNNING(td), ("%s: not TDS_RUNNING", __func__)); \
KASSERT((cvp) != NULL, ("%s: cvp NULL", __func__)); \
KASSERT((lock) != NULL, ("%s: lock NULL", __func__)); \
} while (0)

Definition at line 66 of file kern_condvar.c.

◆ CV_WAITERS_BOUND

#define CV_WAITERS_BOUND   INT_MAX

Definition at line 56 of file kern_condvar.c.

◆ CV_WAITERS_INC

#define CV_WAITERS_INC (   cvp)
Value:
do { \
if ((cvp)->cv_waiters < CV_WAITERS_BOUND) \
(cvp)->cv_waiters++; \
} while (0)
#define CV_WAITERS_BOUND
Definition: kern_condvar.c:56

Definition at line 58 of file kern_condvar.c.

Function Documentation

◆ __FBSDID()

__FBSDID ( "$FreeBSD$"  )

◆ _cv_timedwait_sbt()

int _cv_timedwait_sbt ( struct cv *  cvp,
struct lock_object *  lock,
sbintime_t  sbt,
sbintime_t  pr,
int  flags 
)

Definition at line 273 of file kern_condvar.c.

References CV_ASSERT, CV_WAITERS_INC, flags, Giant, pr, sleepq_add(), sleepq_lock(), sleepq_release(), sleepq_set_timeout_sbt(), and sleepq_timedwait().

Here is the call graph for this function:

◆ _cv_timedwait_sig_sbt()

int _cv_timedwait_sig_sbt ( struct cv *  cvp,
struct lock_object *  lock,
sbintime_t  sbt,
sbintime_t  pr,
int  flags 
)

Definition at line 335 of file kern_condvar.c.

References CV_ASSERT, CV_WAITERS_INC, flags, Giant, pr, sleepq_add(), sleepq_lock(), sleepq_release(), sleepq_set_timeout_sbt(), and sleepq_timedwait_sig().

Here is the call graph for this function:

◆ _cv_wait()

void _cv_wait ( struct cv *  cvp,
struct lock_object *  lock 
)

Definition at line 109 of file kern_condvar.c.

References CV_ASSERT, CV_WAITERS_INC, Giant, sleepq_add(), sleepq_lock(), sleepq_release(), and sleepq_wait().

Here is the call graph for this function:

◆ _cv_wait_sig()

int _cv_wait_sig ( struct cv *  cvp,
struct lock_object *  lock 
)

Definition at line 213 of file kern_condvar.c.

References CV_ASSERT, CV_WAITERS_INC, Giant, sleepq_add(), sleepq_lock(), sleepq_release(), and sleepq_wait_sig().

Here is the call graph for this function:

◆ _cv_wait_unlock()

void _cv_wait_unlock ( struct cv *  cvp,
struct lock_object *  lock 
)

Definition at line 164 of file kern_condvar.c.

References CV_ASSERT, CV_WAITERS_INC, Giant, sleepq_add(), sleepq_lock(), sleepq_release(), and sleepq_wait().

Here is the call graph for this function:

◆ cv_broadcastpri()

void cv_broadcastpri ( struct cv *  cvp,
int  pri 
)

Definition at line 424 of file kern_condvar.c.

References sleepq_broadcast(), sleepq_lock(), and sleepq_release().

Referenced by doselwakeup(), and logtimeout().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ cv_destroy()

void cv_destroy ( struct cv *  cvp)

Definition at line 89 of file kern_condvar.c.

References sleepq_lock(), sleepq_lookup(), and sleepq_release().

Referenced by ksem_drop(), seltdfini(), sema_destroy(), sendfile_sync_destroy(), and tty_dealloc().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ cv_init()

void cv_init ( struct cv *  cvp,
const char *  desc 
)

Definition at line 77 of file kern_condvar.c.

Referenced by devinit(), ksem_alloc(), log_drvinit(), proc_init(), pts_alloc(), pts_alloc_external(), seltdinit(), sema_init(), tty_alloc_mutex(), vn_sendfile(), and vntblinit().

Here is the caller graph for this function:

◆ cv_signal()

void cv_signal ( struct cv *  cvp)

Definition at line 398 of file kern_condvar.c.

References CV_WAITERS_BOUND, sleepq_lock(), sleepq_lookup(), sleepq_release(), and sleepq_signal().

Referenced by _sema_post(), sendfile_sync_signal(), sys_ksem_post(), and ttydev_write().

Here is the call graph for this function:
Here is the caller graph for this function: