本文整理汇总了C++中TAILQ_HEAD_INITIALIZER函数的典型用法代码示例。如果您正苦于以下问题:C++ TAILQ_HEAD_INITIALIZER函数的具体用法?C++ TAILQ_HEAD_INITIALIZER怎么用?C++ TAILQ_HEAD_INITIALIZER使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了TAILQ_HEAD_INITIALIZER函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: t_all_backends
const struct t_backendQ *
t_all_backends(void)
{
static int initialized = 0;
static struct t_backendQ bQ = TAILQ_HEAD_INITIALIZER(bQ);
if (!initialized) {
/* add each available backend (order matter) */
/* FLAC files support using libflac */
if (t_ftflac_backend != NULL)
TAILQ_INSERT_TAIL(&bQ, t_ftflac_backend(), entries);
/* Ogg/Vorbis files support using libogg/libvorbis */
if (t_ftoggvorbis_backend != NULL)
TAILQ_INSERT_TAIL(&bQ, t_ftoggvorbis_backend(), entries);
/* Multiple files types support using TagLib */
if (t_fttaglib_backend != NULL)
TAILQ_INSERT_TAIL(&bQ, t_fttaglib_backend(), entries);
/* mp3 ID3v1.1 files types support */
if (t_ftid3v1_backend != NULL)
TAILQ_INSERT_TAIL(&bQ, t_ftid3v1_backend(), entries);
initialized = 1;
}
return (&bQ);
}
示例2: futex_wake
static inline int futex_wake(int *uaddr, int count)
{
struct futex_element *e,*n = NULL;
struct futex_queue q = TAILQ_HEAD_INITIALIZER(q);
// Atomically grab all relevant futex blockers
// from the global futex queue
mcs_pdr_lock(&__futex.lock);
e = TAILQ_FIRST(&__futex.queue);
while(e != NULL) {
if(count > 0) {
n = TAILQ_NEXT(e, link);
if(e->uaddr == uaddr) {
TAILQ_REMOVE(&__futex.queue, e, link);
TAILQ_INSERT_TAIL(&q, e, link);
count--;
}
e = n;
}
else break;
}
mcs_pdr_unlock(&__futex.lock);
// Unblock them outside the lock
e = TAILQ_FIRST(&q);
while(e != NULL) {
n = TAILQ_NEXT(e, link);
TAILQ_REMOVE(&q, e, link);
while(e->pthread == NULL)
cpu_relax();
uthread_runnable((struct uthread*)e->pthread);
e = n;
}
return 0;
}
示例3: __free_page
void
__free_page(struct page *page)
{
struct pglist pglist = TAILQ_HEAD_INITIALIZER(pglist);
TAILQ_INSERT_TAIL(&pglist, &page->p_vmp, pageq.queue);
uvm_pglistfree(&pglist);
}
示例4: TAILQ_HEAD_INITIALIZER
static void *timer_thread(void *arg)
{
struct futex_element *e,*n = NULL;
struct futex_queue q = TAILQ_HEAD_INITIALIZER(q);
// Do this forever...
for(;;) {
// Block for 1 millisecond
sys_block(1000);
// Then atomically do the following...
mcs_pdr_lock(&__futex.lock);
// Up the time
__futex.time++;
// Find all futexes that have timed out on this iteration,
// and count those still waiting
int waiting = 0;
e = TAILQ_FIRST(&__futex.queue);
while(e != NULL) {
n = TAILQ_NEXT(e, link);
if(e->ms_timeout == __futex.time) {
e->timedout = true;
TAILQ_REMOVE(&__futex.queue, e, link);
TAILQ_INSERT_TAIL(&q, e, link);
}
else if(e->ms_timeout != (uint64_t)-1)
waiting++;
e = n;
}
// If there are no more waiting, disable the timer
if(waiting == 0) {
__futex.time = 0;
__futex.timer_enabled = false;
}
mcs_pdr_unlock(&__futex.lock);
// Unblock any futexes that have timed out outside the lock
e = TAILQ_FIRST(&q);
while(e != NULL) {
n = TAILQ_NEXT(e, link);
TAILQ_REMOVE(&q, e, link);
while(e->pthread == NULL)
cpu_relax();
uthread_runnable((struct uthread*)e->pthread);
e = n;
}
// If we have disabled the timer, park this thread
futex_wait(&__futex.timer_enabled, false, -1);
}
}
示例5: sudo_read_nss
/*
* Non-nsswitch.conf version with hard-coded order.
*/
struct sudo_nss_list *
sudo_read_nss(void)
{
static struct sudo_nss_list snl = TAILQ_HEAD_INITIALIZER(snl);
debug_decl(sudo_read_nss, SUDO_DEBUG_NSS)
# ifdef HAVE_SSSD
TAILQ_INSERT_TAIL(&snl, &sudo_nss_sss, entries);
# endif
# ifdef HAVE_LDAP
TAILQ_INSERT_TAIL(&snl, &sudo_nss_ldap, entries);
# endif
TAILQ_INSERT_TAIL(&snl, &sudo_nss_file, entries);
debug_return_ptr(&snl);
}
示例6: sudoers_policy_open
static int
sudoers_policy_open(unsigned int version, sudo_conv_t conversation,
sudo_printf_t plugin_printf, char * const settings[],
char * const user_info[], char * const envp[], char * const args[])
{
struct sudo_conf_debug_file_list debug_files = TAILQ_HEAD_INITIALIZER(debug_files);
struct sudoers_policy_open_info info;
const char *plugin_path = NULL;
char * const *cur;
debug_decl(sudoers_policy_open, SUDOERS_DEBUG_PLUGIN)
sudo_version = version;
sudo_conv = conversation;
sudo_printf = plugin_printf;
/* Plugin args are only specified for API version 1.2 and higher. */
if (sudo_version < SUDO_API_MKVERSION(1, 2))
args = NULL;
/* Initialize the debug subsystem. */
for (cur = settings; *cur != NULL; cur++) {
if (strncmp(*cur, "debug_flags=", sizeof("debug_flags=") - 1) == 0) {
sudoers_debug_parse_flags(&debug_files,
*cur + sizeof("debug_flags=") - 1);
continue;
}
if (strncmp(*cur, "plugin_path=", sizeof("plugin_path=") - 1) == 0) {
plugin_path = *cur + sizeof("plugin_path=") - 1;
continue;
}
}
sudoers_debug_register(plugin_path, &debug_files);
/* Call the sudoers init function. */
info.settings = settings;
info.user_info = user_info;
info.plugin_args = args;
debug_return_bool(sudoers_policy_init(&info, envp));
}
示例7: TAILQ_HEAD
/* Allow the application to print its usage message too if set */
static rte_usage_hook_t rte_application_usage_hook = NULL;
TAILQ_HEAD(shared_driver_list, shared_driver);
/* Definition for shared object drivers. */
struct shared_driver {
TAILQ_ENTRY(shared_driver) next;
char name[PATH_MAX];
void* lib_handle;
};
/* List of external loadable drivers */
static struct shared_driver_list solib_list =
TAILQ_HEAD_INITIALIZER(solib_list);
/* early configuration structure, when memory config is not mmapped */
static struct rte_mem_config early_mem_config;
/* define fd variable here, because file needs to be kept open for the
* duration of the program, as we hold a write lock on it in the primary proc */
static int mem_cfg_fd = -1;
static struct flock wr_lock = {
.l_type = F_WRLCK,
.l_whence = SEEK_SET,
.l_start = offsetof(struct rte_mem_config, memseg),
.l_len = sizeof(early_mem_config.memseg),
};
示例8: TAILQ_HEAD
#include <infiniband/driver.h>
#include "usnic_direct.h"
#include "usd.h"
#include "usd_ib_sysfs.h"
#include "usd_ib_cmd.h"
#include "usd_socket.h"
#include "usd_device.h"
static pthread_once_t usd_init_once = PTHREAD_ONCE_INIT;
static struct usd_ib_dev *usd_ib_dev_list;
static int usd_init_error;
TAILQ_HEAD(,usd_device) usd_device_list =
TAILQ_HEAD_INITIALIZER(usd_device_list);
/*
* Perform one-time initialization
*/
static void
do_usd_init(void)
{
usd_init_error = usd_ib_get_devlist(&usd_ib_dev_list);
}
/*
* Init routine
*/
static int
usd_init(void)
示例9: TAILQ_HEAD
unsigned int tq_nthreads;
unsigned int tq_flags;
const char *tq_name;
struct mutex tq_mtx;
TAILQ_HEAD(, task) tq_worklist;
};
struct taskq taskq_sys = {
TQ_S_CREATED,
0,
1,
0,
"systq",
MUTEX_INITIALIZER(IPL_HIGH),
TAILQ_HEAD_INITIALIZER(taskq_sys.tq_worklist)
};
struct taskq taskq_sys_mp = {
TQ_S_CREATED,
0,
1,
TASKQ_MPSAFE,
"systqmp",
MUTEX_INITIALIZER(IPL_HIGH),
TAILQ_HEAD_INITIALIZER(taskq_sys_mp.tq_worklist)
};
typedef int (*sleepfn)(const volatile void *, struct mutex *, int,
const char *, int);
示例10: TAILQ_ENTRY
struct filemon {
TAILQ_ENTRY(filemon) link; /* Link into the in-use list. */
struct mtx mtx; /* Lock mutex for this filemon. */
struct cv cv; /* Lock condition variable for this
filemon. */
struct file *fp; /* Output file pointer. */
struct thread *locker; /* Ptr to the thread locking this
filemon. */
pid_t pid; /* The process ID being monitored. */
char fname1[MAXPATHLEN]; /* Temporary filename buffer. */
char fname2[MAXPATHLEN]; /* Temporary filename buffer. */
char msgbufr[1024]; /* Output message buffer. */
};
static TAILQ_HEAD(, filemon) filemons_inuse = TAILQ_HEAD_INITIALIZER(filemons_inuse);
static TAILQ_HEAD(, filemon) filemons_free = TAILQ_HEAD_INITIALIZER(filemons_free);
static int n_readers = 0;
static struct mtx access_mtx;
static struct cv access_cv;
static struct thread *access_owner = NULL;
static struct thread *access_requester = NULL;
static struct cdev *filemon_dev;
#include "filemon_lock.c"
#include "filemon_wrapper.c"
static void
filemon_dtr(void *data)
{
示例11: errx
do { \
if (t->size != exp) { \
errx(1, "unexpected size for token \"%.*s\" " \
"in \"%s\"", T_PRINTFSTAR(t,data), fun); \
} \
} while (/*CONSTCOND*/0)
static char *
token2cstr(jsmntok_t *t, char *data)
{
*(T_STR(t, data) + T_SIZE(t)) = '\0';
return T_STR(t, data);
}
struct rumprun_execs rumprun_execs = TAILQ_HEAD_INITIALIZER(rumprun_execs);
static void
makeargv(char *argvstr)
{
struct rumprun_exec *rre;
char **argv;
int nargs;
rumprun_parseargs(argvstr, &nargs, 0);
rre = malloc(sizeof(*rre) + (nargs+1) * sizeof(*argv));
if (rre == NULL)
err(1, "could not allocate rre");
rumprun_parseargs(argvstr, &nargs, rre->rre_argv);
rre->rre_argv[nargs] = NULL;
示例12: rtflushclone
void rtflushclone(struct radix_node_head *, struct rtentry *);
int rt_if_remove_rtdelete(struct radix_node *, void *);
#ifndef SMALL_KERNEL
int rt_if_linkstate_change(struct radix_node *, void *);
#endif
#define LABELID_MAX 50000
struct rt_label {
TAILQ_ENTRY(rt_label) rtl_entry;
char rtl_name[RTLABEL_LEN];
u_int16_t rtl_id;
int rtl_ref;
};
TAILQ_HEAD(rt_labels, rt_label) rt_labels = TAILQ_HEAD_INITIALIZER(rt_labels);
#ifdef IPSEC
struct ifaddr *
encap_findgwifa(struct sockaddr *gw)
{
return (TAILQ_FIRST(&encif[0].sc_if.if_addrlist));
}
#endif
int
rtable_init(struct radix_node_head ***table)
{
void **p;
struct domain *dom;
示例13: TAILQ_ENTRY
/**
* A notification message to store in the queue of message to go out to the
* mgmt component
*/
typedef struct notification_msg_s {
conf_msg_type_e action; ///< action to send
subscriber_status_t message; ///< data to send
TAILQ_ENTRY(notification_msg_s) entries; ///< ptrs to next/prev
} notification_msg_t;
/**
* List of notification messages to buffer until main thread processes msgs
*/
static TAILQ_HEAD(notification_buffer_s, notification_msg_s) notification_msgs =
TAILQ_HEAD_INITIALIZER(notification_msgs);
static pthread_mutex_t msgs_lock; ///< lock for accessing notification_msgs
static pconn_client_t * mgmt_client; ///< client cnx to mgmt component
static evTimerID mgmt_timer_id; ///< timerID for retrying cnx to mgmt
static evContext main_ctx; ///< event context for main thread
/*** STATIC/INTERNAL Functions ***/
/**
* Fwd declaration of function to setup the connection to the mgmt component
*/
static void connect_mgmt(evContext ctx, void * uap,
struct timespec due, struct timespec inter);
示例14: TAILQ_HEAD
#include "wireless.h"
#include "EAPLog.h"
struct scanCallbackEntry_s;
typedef struct scanCallbackEntry_s scanCallbackEntry, * scanCallbackEntryRef;
typedef TAILQ_HEAD(scanCallbackHead_s, scanCallbackEntry_s) scanCallbackHead;
#if 0
static __inline
not_used() {};
/* this is here so that emacs indent doesn't get confused - what a pain*/
#endif
typedef struct scanCallbackHead_s * scanCallbackHeadRef;
static scanCallbackHead S_head = TAILQ_HEAD_INITIALIZER(S_head);
static scanCallbackHeadRef S_scanCallbackHead_p = &S_head;
enum {
kScanCallbackStateNone = 0,
kScanCallbackStateStarted = 1,
kScanCallbackStateComplete = 2
};
struct scanCallbackEntry_s {
Apple80211Ref wref;
wireless_scan_callback_t func;
void * arg;
CFStringRef ssid;
uint32_t state;
TAILQ_ENTRY(scanCallbackEntry_s) link;
示例15: TAILQ_ENTRY
/*
* Structure to hold a route
*/
struct natm_route {
TAILQ_ENTRY(natm_route) link;
struct in_addr host;
struct diagif *aif;
u_int flags;
int llcsnap;
u_int vpi, vci;
u_int traffic;
u_int pcr, scr, mbs, icr, mcr;
u_int tbe, nrm, trm, adtf, rif, rdf, cdf;
};
static TAILQ_HEAD(, natm_route) natm_route_list =
TAILQ_HEAD_INITIALIZER(natm_route_list);
static void
store_route(struct rt_msghdr *rtm)
{
u_int i;
struct natm_route *r;
char *cp;
struct sockaddr *sa;
struct sockaddr_in *sain;
struct sockaddr_dl *sdl;
struct diagif *aif;
u_int n;
r = malloc(sizeof(*r));
if (r == NULL)