这篇教程C++ spinlock_init函数代码示例写得很实用,希望能帮到您。
本文整理汇总了C++中spinlock_init函数的典型用法代码示例。如果您正苦于以下问题:C++ spinlock_init函数的具体用法?C++ spinlock_init怎么用?C++ spinlock_init使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。 在下文中一共展示了spinlock_init函数的29个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。 示例1: spinlock_init/* * udp_instance_alloc() */struct udp_instance *udp_instance_alloc(struct ip_instance *ii){ struct udp_instance *ui; struct ip_client *ic; ui = (struct udp_instance *)membuf_alloc(sizeof(struct udp_instance), NULL); ui->ui_client_attach = udp_client_attach; ui->ui_client_detach = udp_client_detach; ui->ui_client_list = NULL; spinlock_init(&ui->ui_lock, 0x24); /* * Attach this protocol handler to the IP stack. */ ic = ip_client_alloc(); ic->ic_protocol = 0x11; ic->ic_recv = udp_recv_netbuf; ic->ic_recv_icmp = NULL; ic->ic_instance = ui; udp_instance_ref(ui); ui->ui_server = ii->ii_ip_client_attach(ii, ic); ip_client_deref(ic); return ui;}
开发者ID:Numeromancer,项目名称:liquorice,代码行数:29,
示例2: sem_createstruct semaphore *sem_create(const char *name, int initial_count){ struct semaphore *sem; KASSERT(initial_count >= 0); sem = kmalloc(sizeof(struct semaphore)); if (sem == NULL) { return NULL; } sem->sem_name = kstrdup(name); if (sem->sem_name == NULL) { kfree(sem); return NULL; } sem->sem_wchan = wchan_create(sem->sem_name); if (sem->sem_wchan == NULL) { kfree(sem->sem_name); kfree(sem); return NULL; } spinlock_init(&sem->sem_lock); sem->sem_count = initial_count; return sem;}
开发者ID:shaon0000,项目名称:massive-wookie,代码行数:30,
示例3: vn_initializestruct vnode *vn_initialize( struct inode *inode){ struct vnode *vp = LINVFS_GET_VP(inode); XFS_STATS_INC(vn_active); XFS_STATS_INC(vn_alloc); vp->v_flag = VMODIFIED; spinlock_init(&vp->v_lock, "v_lock"); spin_lock(&vnumber_lock); if (!++vn_generation) /* v_number shouldn't be zero */ vn_generation++; vp->v_number = vn_generation; spin_unlock(&vnumber_lock); ASSERT(VN_CACHED(vp) == 0); /* Initialize the first behavior and the behavior chain head. */ vn_bhv_head_init(VN_BHV_HEAD(vp), "vnode");#ifdef XFS_VNODE_TRACE vp->v_trace = ktrace_alloc(VNODE_TRACE_SIZE, KM_SLEEP);#endif /* XFS_VNODE_TRACE */ vn_trace_exit(vp, "vn_initialize", (inst_t *)__return_address); return vp;}
开发者ID:OpenHMR,项目名称:Open-HMR600,代码行数:30,
示例4: tprintf_initvoid tprintf_init(void){ spinlock_init(&buffer_lock); setvbuf(stdout, NULL, _IONBF, 0); setvbuf(stderr, NULL, _IONBF, 0);}
开发者ID:hhatto,项目名称:netsniff-ng,代码行数:7,
示例5: lock_createstruct lock *lock_create(const char *name){ struct lock *lock; lock = kmalloc(sizeof(struct lock)); if (lock == NULL) { return NULL; } lock->lk_name = kstrdup(name); if (lock->lk_name == NULL) { kfree(lock); return NULL; }#if OPT_A1 lock->lock_wchan = wchan_create(lock->lk_name); if (lock->lock_wchan == NULL) { kfree(lock->lk_name); kfree(lock); } spinlock_init(&lock->lk_spinlock); lock->available = true;#endif return lock;}
开发者ID:shaon0000,项目名称:massive-wookie,代码行数:27,
示例6: ModuleInit/** * The module initialisation routine, called when the module * is first loaded. */voidModuleInit(){ MXS_NOTICE("Initialise debug CLI router module %s.", version_str); spinlock_init(&instlock); instances = NULL;}
开发者ID:DBMSRmutl,项目名称:MaxScale,代码行数:11,
示例7: id_gen_testint id_gen_test(int nargs, char **args){ sem_numthread = sem_create("sem_testidgen",0); struct spinlock splock; spinlock_init(&splock); idgen = idgen_create(0); KASSERT(idgen != NULL); (void)nargs; (void)args; const int NUMTHREAD = 3; int i = 0; for (; i < NUMTHREAD; i++){ kprintf ("MAKING THREAD %d/n", i); thread_fork("id_gen_test", NULL, test_generator, NULL, i); } for (int j = 0; j < NUMTHREAD; j++,i++){ kprintf ("MAKING THREAD %d/n", i); thread_fork("id_gen_test", NULL, test_generator2, NULL, i); } for (int j = 0; j < 2*NUMTHREAD; j++){ P(sem_numthread); } idgen_destroy(idgen); sem_destroy(sem_numthread); return 0;}
开发者ID:achankf,项目名称:CS350-OS161,代码行数:32,
示例8: service_alloc/** * Allocate a new service for the gateway to support * * * @param servname The service name * @param router Name of the router module this service uses * * @return The newly created service or NULL if an error occured */SERVICE *service_alloc(char *servname, char *router){SERVICE *service; if ((service = (SERVICE *)malloc(sizeof(SERVICE))) == NULL) return NULL; if ((service->router = load_module(router, MODULE_ROUTER)) == NULL) { free(service); return NULL; } service->name = strdup(servname); service->routerModule = strdup(router); memset(&service->stats, 0, sizeof(SERVICE_STATS)); service->ports = NULL; service->stats.started = time(0); service->state = SERVICE_STATE_ALLOC; service->credentials.name = NULL; service->credentials.authdata = NULL; service->users = users_alloc(); service->enable_root = 0; service->routerOptions = NULL; service->databases = NULL; spinlock_init(&service->spin); spinlock_acquire(&service_spin); service->next = allServices; allServices = service; spinlock_release(&service_spin); return service;}
开发者ID:huangzhiyong,项目名称:MaxScale,代码行数:42,
示例9: cv_createstruct cv *cv_create(const char *name){ struct cv *cv; cv = kmalloc(sizeof(*cv)); if (cv == NULL) { return NULL; } cv->cv_name = kstrdup(name); if (cv->cv_name==NULL) { kfree(cv); return NULL; } cv->cv_wchan = wchan_create(cv->cv_name); if (cv->cv_wchan == NULL) { kfree(cv->cv_name); kfree(cv); return NULL; } spinlock_init(&cv->cv_spinlock); // add stuff here as needed return cv;}
开发者ID:srikk595,项目名称:Operating-Systems-OS161,代码行数:28,
示例10: prepare_for_sleepu32prepare_for_sleep (u32 firmware_waking_vector){ u8 *p; int wakeup_entry_len; /* Get the suspend-lock to make other processors stopping or staying in the guest mode. */ get_suspend_lock (); /* Now the VMM is executed by the current processor only. Call suspend functions. */ call_initfunc ("suspend"); /* Initialize variables used by wakeup functions */ wakeup_cpucount = 0; spinlock_init (&wakeup_cpucount_lock); waking_vector = firmware_waking_vector; wakeup_prepare (); /* Copy the wakeup_entry code. */ wakeup_entry_len = wakeup_entry_end - wakeup_entry_start; p = mapmem_hphys (wakeup_entry_addr, wakeup_entry_len, MAPMEM_WRITE); memcpy (p, wakeup_entry_start, wakeup_entry_len); unmapmem (p, wakeup_entry_len); return wakeup_entry_addr;}
开发者ID:crazycoderx2,项目名称:bitvisor,代码行数:27,
示例11: lock_createstruct lock *lock_create(const char *name){ struct lock *lock; lock = kmalloc(sizeof(*lock)); if (lock == NULL) { return NULL; } lock->lk_name = kstrdup(name); if (lock->lk_name == NULL) { kfree(lock); return NULL; } lock->lk_wchan = wchan_create(lock->lk_name); if (lock->lk_wchan == NULL) { kfree(lock->lk_name); kfree(lock); return NULL; } spinlock_init(&lock->lk_spinlock); lock->lk_isheld = false; lock->lk_curthread = NULL; // add stuff here as needed return lock;}
开发者ID:srikk595,项目名称:Operating-Systems-OS161,代码行数:30,
示例12: lock_createstruct lock *lock_create(const char *name){ struct lock *lock; lock = kmalloc(sizeof(struct lock)); if (lock == NULL) { return NULL; } lock->lk_name = kstrdup(name); if (lock->lk_name == NULL) { kfree(lock); return NULL; } // add stuff here as needed //Peng 2.19.2016 lock->lock_wchan = wchan_create(lock->lk_name); if (lock->lock_wchan == NULL) { kfree(lock->lk_name); kfree(lock); return NULL; } spinlock_init(&lock->lock_splk); lock->held=false; lock->holder=NULL; //Peng return lock;}
开发者ID:patricksu,项目名称:repo3,代码行数:31,
示例13: hubspc_init/* * hubspc_init * Registration of the hubspc devices with the hub manager */voidhubspc_init(void){ /* * Register with the hub manager */ /* The reference counters */ hubdev_register(mem_refcnt_attach); /* Prom space */ hubdev_register(cpuprom_attach);#if defined(CONFIG_SERIAL_SGI_L1_PROTOCOL) /* L1 system controller link */ if ( !IS_RUNNING_ON_SIMULATOR() ) { /* initialize the L1 link */ void l1_cons_init( l1sc_t *sc ); elsc_t *get_elsc(void); l1_cons_init((l1sc_t *)get_elsc()); }#endif#ifdef HUBSPC_DEBUG printf("hubspc_init: Completed/n");#endif /* HUBSPC_DEBUG */ /* Initialize spinlocks */ spinlock_init(&cpuprom_spinlock, "promlist");}
开发者ID:dot-Sean,项目名称:linux_kernels,代码行数:34,
|