当前位置: 首页>>代码示例>>C++>>正文


C++ TAILQ_HEAD_INITIALIZER函数代码示例

本文整理汇总了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);
}
开发者ID:Rolinh,项目名称:tagutil,代码行数:30,代码来源:t_backend.c

示例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;
}
开发者ID:ajbetteridge,项目名称:akaros,代码行数:35,代码来源:futex.c

示例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);
}
开发者ID:eyberg,项目名称:rumpkernel-netbsd-src,代码行数:9,代码来源:linux_gfp.c

示例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);
  }
}
开发者ID:ajbetteridge,项目名称:akaros,代码行数:52,代码来源:futex.c

示例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);
}
开发者ID:JamesHagerman,项目名称:sudo-1.8.10p3-pword-debugging,代码行数:19,代码来源:sudo_nss.c

示例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));
}
开发者ID:ScottyBauer,项目名称:sudo-1.8.13,代码行数:39,代码来源:policy.c

示例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),
};
开发者ID:AMildner,项目名称:MoonGen,代码行数:30,代码来源:eal.c

示例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)
开发者ID:ggouaillardet,项目名称:libfabric,代码行数:31,代码来源:usd_device.c

示例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);
开发者ID:orumin,项目名称:openbsd-efivars,代码行数:30,代码来源:kern_task.c

示例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)
{
开发者ID:ChaosJohn,项目名称:freebsd,代码行数:30,代码来源:filemon.c

示例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;
开发者ID:RWTH-OS,项目名称:rumprun,代码行数:31,代码来源:config.c

示例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;
开发者ID:7shi,项目名称:openbsd-loongson-vc,代码行数:30,代码来源:route.c

示例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);
开发者ID:jameskellynet,项目名称:junos-sdk-sample-apps,代码行数:30,代码来源:dpm-ctrl_conn.c

示例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;
开发者ID:gfleury,项目名称:eap8021x-debug,代码行数:31,代码来源:wireless.c

示例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)
开发者ID:MattDooner,项目名称:freebsd-west,代码行数:31,代码来源:natm.c


注:本文中的TAILQ_HEAD_INITIALIZER函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。