• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C++ spin_trylock函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中spin_trylock函数的典型用法代码示例。如果您正苦于以下问题:C++ spin_trylock函数的具体用法?C++ spin_trylock怎么用?C++ spin_trylock使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了spin_trylock函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: x86_backtrace

void
x86_backtrace(struct pt_regs * const regs, unsigned int depth)
{
	struct frame_head *head;

#ifdef CONFIG_X86_64
	head = (struct frame_head *)regs->rbp;
#else
	head = (struct frame_head *)regs->ebp;
#endif

	if (!user_mode_vm(regs)) {
		while (depth-- && valid_kernel_stack(head, regs))
			head = dump_backtrace(head);
		return;
	}

#ifdef CONFIG_SMP
	if (!spin_trylock(&current->mm->page_table_lock))
		return;
#endif

	while (depth-- && head && pages_present(head))
		head = dump_backtrace(head);

#ifdef CONFIG_SMP
	spin_unlock(&current->mm->page_table_lock);
#endif
}
开发者ID:camelguo,项目名称:linux-2.6-trimedia,代码行数:29,代码来源:backtrace.c


示例2: serial_hsu_console_write

/*
 * Print a string to the serial port trying not to disturb
 * any possible real use of the port...
 *
 *	The console_lock must be held when we get here.
 */
static void
serial_hsu_console_write(struct console *co, const char *s, unsigned int count)
{
	struct uart_hsu_port *up = serial_hsu_ports[co->index];
	unsigned long flags;
	unsigned int ier;
	int locked = 1;

	local_irq_save(flags);
	if (up->port.sysrq)
		locked = 0;
	else if (oops_in_progress) {
		locked = spin_trylock(&up->port.lock);
	} else
		spin_lock(&up->port.lock);

	/* First save the IER then disable the interrupts */
	ier = serial_in(up, UART_IER);
	serial_out(up, UART_IER, 0);

	uart_console_write(&up->port, s, count, serial_hsu_console_putchar);

	/*
	 * Finally, wait for transmitter to become empty
	 * and restore the IER
	 */
	wait_for_xmitr(up);
	serial_out(up, UART_IER, ier);

	if (locked)
		spin_unlock(&up->port.lock);
	local_irq_restore(flags);
}
开发者ID:33d,项目名称:linux-2.6.21-hh20,代码行数:39,代码来源:mfd.c


示例3: serial_tx_interrupt

void serial_tx_interrupt(struct serial_port *port, struct cpu_user_regs *regs)
{
    int i, n;
    unsigned long flags;

    local_irq_save(flags);

    /*
     * Avoid spinning for a long time: if there is a long-term lock holder
     * then we know that they'll be stuffing bytes into the transmitter which
     * will therefore not be empty for long.
     */
    while ( !spin_trylock(&port->tx_lock) )
    {
        if ( port->driver->tx_ready(port) <= 0 )
            goto out;
        cpu_relax();
    }

    for ( i = 0, n = port->driver->tx_ready(port); i < n; i++ )
    {
        if ( port->txbufc == port->txbufp )
            break;
        port->driver->putc(
            port, port->txbuf[mask_serial_txbuf_idx(port->txbufc++)]);
    }
    if ( i && port->driver->flush )
        port->driver->flush(port);

    spin_unlock(&port->tx_lock);

 out:
    local_irq_restore(flags);
}
开发者ID:HPSI,项目名称:xen-v4v,代码行数:34,代码来源:serial.c


示例4: set_a_bus_req

static ssize_t
set_a_bus_req(struct device *dev, struct device_attribute *attr,
	      const char *buf, size_t count)
{
	struct mv_otg *mvotg = dev_get_drvdata(dev);

	if (count > 2)
		return -1;

	/* We will use this interface to change to A device */
	if (mvotg->phy.state != OTG_STATE_B_IDLE
	    && mvotg->phy.state != OTG_STATE_A_IDLE)
		return -1;

	/* The clock may disabled and we need to set irq for ID detected */
	mv_otg_enable(mvotg);
	mv_otg_init_irq(mvotg);

	if (buf[0] == '1') {
		mvotg->otg_ctrl.a_bus_req = 1;
		mvotg->otg_ctrl.a_bus_drop = 0;
		dev_dbg(&mvotg->pdev->dev,
			"User request: a_bus_req = 1\n");

		if (spin_trylock(&mvotg->wq_lock)) {
			mv_otg_run_state_machine(mvotg, 0);
			spin_unlock(&mvotg->wq_lock);
		}
	}

	return count;
}
开发者ID:AiWinters,项目名称:linux,代码行数:32,代码来源:mv_otg.c


示例5: softuart_downcall

/*
 * This is called when the HV needs to signal that receive data is
 * available to read or that transmit buffer space has become
 * available.
 */
static void softuart_downcall(struct hv_driver_cb *cb, __hv32 reason)
{
	unsigned long flags;

	local_irq_save(flags);
	if (spin_trylock(&softuart_callback_lock)) {
		struct softuart_private *softuartp =
			(struct softuart_private *)cb->dev;
		struct tty_struct *tty = softuartp->tty;
		if (tty) {
			if (reason == SOFTUART_CLIENTINT_RX) {
				/*
				 * Some data has been received by the
				 * HV driver and is ready to read.
				 */
				softuart_do_receive_chars(tty);
			} else if (reason == SOFTUART_CLIENTINT_WRITEROOM) {
				/*
				 * If the output buffer had filled up then the
				 * tty has been put to sleep.  The HV has
				 * indicated that there's buffer space
				 * available, so we wake the tty up.
				 */
				if (waitqueue_active(&tty->write_wait) &&
				    softuart_write_room(tty))
					tty_wakeup(tty);
			}
		}
		spin_unlock(&softuart_callback_lock);
	}
	local_irq_restore(flags);
}
开发者ID:rslotte,项目名称:OGS-Tile,代码行数:37,代码来源:softuart.c


示例6: set_a_bus_drop

static ssize_t
set_a_bus_drop(struct device *dev, struct device_attribute *attr,
	       const char *buf, size_t count)
{
	struct mv_otg *mvotg = dev_get_drvdata(dev);
	if (!mvotg->phy.otg->default_a)
		return -1;

	if (count > 2)
		return -1;

	if (buf[0] == '0') {
		mvotg->otg_ctrl.a_bus_drop = 0;
		dev_dbg(&mvotg->pdev->dev,
			"User request: a_bus_drop = 0\n");
	} else if (buf[0] == '1') {
		mvotg->otg_ctrl.a_bus_drop = 1;
		mvotg->otg_ctrl.a_bus_req = 0;
		dev_dbg(&mvotg->pdev->dev,
			"User request: a_bus_drop = 1\n");
		dev_dbg(&mvotg->pdev->dev,
			"User request: and a_bus_req = 0\n");
	}

	if (spin_trylock(&mvotg->wq_lock)) {
		mv_otg_run_state_machine(mvotg, 0);
		spin_unlock(&mvotg->wq_lock);
	}

	return count;
}
开发者ID:AiWinters,项目名称:linux,代码行数:31,代码来源:mv_otg.c


示例7: spinLock_write

static ssize_t spinLock_write(struct file *file, const char __user *buf,
		size_t count, loff_t *ppos)
{
//	char *cmd = (char *) malloc(sizeof(char *));
	char cmd[10] = { 0 };
	if (copy_from_user(cmd, (void*) buf, count))
	{
		return -EINVAL;
	}
	else
	{
		if (strcmp("lock\n", cmd) == 0)
		{
			spin_lock(&lock);
			mdelay(10000);
			spin_unlock(&lock);
		}
		else if (strcmp("trylock\n", cmd) == 0)
		{
			if (spin_trylock(&lock))
			{
				printk("spin_lock is available\n");
				spin_unlock(&lock);
			}
			else
			{
				printk("spin_lock is busy\n");
				return -EBUSY;
			}
		}
		return count;
	}
}
开发者ID:hust-MC,项目名称:Spin_Lock,代码行数:33,代码来源:spin_lock.c


示例8: mce_spin_lock

static void mce_spin_lock(spinlock_t *lk)
{
      while (!spin_trylock(lk)) {
              cpu_relax();
              mce_panic_check();
      }
}
开发者ID:sheep,项目名称:xen,代码行数:7,代码来源:mce.c


示例9: t1_espi_get_mon_t204

/*
 * This function is for T204 only.
 * compare with t1_espi_get_mon(), it reads espiInTxSop[0 ~ 3] in
 * one shot, since there is no per port counter on the out side.
 */
int t1_espi_get_mon_t204(adapter_t *adapter, u32 *valp, u8 wait)
{
	struct peespi *espi = adapter->espi;
	u8 i, nport = (u8)adapter->params.nports;

	if (!wait) {
		if (!spin_trylock(&espi->lock))
			return -1;
	} else
		spin_lock(&espi->lock);

	if ((espi->misc_ctrl & MON_MASK) != F_MONITORED_DIRECTION) {
		espi->misc_ctrl = (espi->misc_ctrl & ~MON_MASK) |
					F_MONITORED_DIRECTION;
		writel(espi->misc_ctrl, adapter->regs + A_ESPI_MISC_CONTROL);
	}
	for (i = 0 ; i < nport; i++, valp++) {
		if (i) {
			writel(espi->misc_ctrl | V_MONITORED_PORT_NUM(i),
			       adapter->regs + A_ESPI_MISC_CONTROL);
		}
		*valp = readl(adapter->regs + A_ESPI_SCH_TOKEN3);
	}

	writel(espi->misc_ctrl, adapter->regs + A_ESPI_MISC_CONTROL);
	spin_unlock(&espi->lock);
	return 0;
}
开发者ID:WiseMan787,项目名称:ralink_sdk,代码行数:33,代码来源:espi.c


示例10: t1_espi_get_mon

u32 t1_espi_get_mon(adapter_t *adapter, u32 addr, u8 wait)
{
	struct peespi *espi = adapter->espi;
	u32 sel;

	if (!is_T2(adapter))
		return 0;

	sel = V_MONITORED_PORT_NUM((addr & 0x3c) >> 2);
	if (!wait) {
		if (!spin_trylock(&espi->lock))
			return 0;
	} else
		spin_lock(&espi->lock);

	if ((sel != (espi->misc_ctrl & MON_MASK))) {
		writel(((espi->misc_ctrl & ~MON_MASK) | sel),
		       adapter->regs + A_ESPI_MISC_CONTROL);
		sel = readl(adapter->regs + A_ESPI_SCH_TOKEN3);
		writel(espi->misc_ctrl, adapter->regs + A_ESPI_MISC_CONTROL);
	} else
		sel = readl(adapter->regs + A_ESPI_SCH_TOKEN3);
	spin_unlock(&espi->lock);
	return sel;
}
开发者ID:WiseMan787,项目名称:ralink_sdk,代码行数:25,代码来源:espi.c


示例11: autofs4_sbi

/*
 * Calculate and dget next entry in top down tree traversal.
 */
static struct dentry *get_next_positive_dentry(struct dentry *prev,
					       struct dentry *root)
{
	struct autofs_sb_info *sbi = autofs4_sbi(root->d_sb);
	struct list_head *next;
	struct dentry *p, *ret;

	if (prev == NULL)
		return dget(root);

	spin_lock(&sbi->lookup_lock);
relock:
	p = prev;
	spin_lock(&p->d_lock);
again:
	next = p->d_subdirs.next;
	if (next == &p->d_subdirs) {
		while (1) {
			struct dentry *parent;

			if (p == root) {
				spin_unlock(&p->d_lock);
				spin_unlock(&sbi->lookup_lock);
				dput(prev);
				return NULL;
			}

			parent = p->d_parent;
			if (!spin_trylock(&parent->d_lock)) {
				spin_unlock(&p->d_lock);
				cpu_relax();
				goto relock;
			}
			spin_unlock(&p->d_lock);
			next = p->d_child.next;
			p = parent;
			if (next != &parent->d_subdirs)
				break;
		}
	}
	ret = list_entry(next, struct dentry, d_child);

	spin_lock_nested(&ret->d_lock, DENTRY_D_LOCK_NESTED);
	/* Negative dentry - try next */
	if (!simple_positive(ret)) {
		spin_unlock(&p->d_lock);
		lock_set_subclass(&ret->d_lock.dep_map, 0, _RET_IP_);
		p = ret;
		goto again;
	}
	dget_dlock(ret);
	spin_unlock(&ret->d_lock);
	spin_unlock(&p->d_lock);
	spin_unlock(&sbi->lookup_lock);

	dput(prev);

	return ret;
}
开发者ID:acton393,项目名称:linux,代码行数:62,代码来源:expire.c


示例12: pstore_dump

/*
 * callback from kmsg_dump. (s2,l2) has the most recently
 * written bytes, older bytes are in (s1,l1). Save as much
 * as we can from the end of the buffer.
 */
static void pstore_dump(struct kmsg_dumper *dumper,
	    enum kmsg_dump_reason reason,
	    const char *s1, unsigned long l1,
	    const char *s2, unsigned long l2)
{
	unsigned long	s1_start, s2_start;
	unsigned long	l1_cpy, l2_cpy;
	unsigned long	size, total = 0;
	char		*dst;
	const char	*why;
	u64		id;
	int		hsize, ret;
	unsigned int	part = 1;
	unsigned long	flags = 0;
	int		is_locked = 0;

	why = get_reason_str(reason);

	if (in_nmi()) {
		is_locked = spin_trylock(&psinfo->buf_lock);
		if (!is_locked)
			pr_err("pstore dump routine blocked in NMI, may corrupt error record\n");
	} else
		spin_lock_irqsave(&psinfo->buf_lock, flags);
	oopscount++;
	while (total < kmsg_bytes) {
		dst = psinfo->buf;
		hsize = sprintf(dst, "%s#%d Part%d\n", why, oopscount, part);
		size = psinfo->bufsize - hsize;
		dst += hsize;

		l2_cpy = min(l2, size);
		l1_cpy = min(l1, size - l2_cpy);

		if (l1_cpy + l2_cpy == 0)
			break;

		s2_start = l2 - l2_cpy;
		s1_start = l1 - l1_cpy;

		memcpy(dst, s1 + s1_start, l1_cpy);
		memcpy(dst + l1_cpy, s2 + s2_start, l2_cpy);

		ret = psinfo->write(PSTORE_TYPE_DMESG, reason, &id, part,
				    oopscount, hsize + l1_cpy + l2_cpy, psinfo);
		if (ret == 0 && reason == KMSG_DUMP_OOPS && pstore_is_mounted())
			pstore_new_entry = 1;
		l1 -= l1_cpy;
		l2 -= l2_cpy;
		total += l1_cpy + l2_cpy;
		part++;
	}
	if (in_nmi()) {
		if (is_locked)
			spin_unlock(&psinfo->buf_lock);
	} else
		spin_unlock_irqrestore(&psinfo->buf_lock, flags);
}
开发者ID:3null,项目名称:fastsocket,代码行数:63,代码来源:platform.c


示例13: process_hvlpevents

void process_hvlpevents(void)
{
	struct HvLpEvent * event;

 restart:
	/* If we have recursed, just return */
	if (!spin_trylock(&hvlpevent_queue.hq_lock))
		return;

	for (;;) {
		event = get_next_hvlpevent();
		if (event) {
			/* Call appropriate handler here, passing
			 * a pointer to the LpEvent.  The handler
			 * must make a copy of the LpEvent if it
			 * needs it in a bottom half. (perhaps for
			 * an ACK)
			 *
			 *  Handlers are responsible for ACK processing
			 *
			 * The Hypervisor guarantees that LpEvents will
			 * only be delivered with types that we have
			 * registered for, so no type check is necessary
			 * here!
			 */
			if (event->xType < HvLpEvent_Type_NumTypes)
				__get_cpu_var(hvlpevent_counts)[event->xType]++;
			if (event->xType < HvLpEvent_Type_NumTypes &&
					lpEventHandler[event->xType])
				lpEventHandler[event->xType](event);
			else {
				u8 type = event->xType;

				/*
				 * Don't printk in the spinlock as printk
				 * may require ack events form the HV to send
				 * any characters there.
				 */
				hvlpevent_clear_valid(event);
				spin_unlock(&hvlpevent_queue.hq_lock);
				printk(KERN_INFO
					"Unexpected Lp Event type=%d\n", type);
				goto restart;
			}

			hvlpevent_clear_valid(event);
		} else if (hvlpevent_queue.hq_overflow_pending)
			/*
			 * No more valid events. If overflow events are
			 * pending process them
			 */
			HvCallEvent_getOverflowLpEvents(hvlpevent_queue.hq_index);
		else
			break;
	}

	spin_unlock(&hvlpevent_queue.hq_lock);
}
开发者ID:ForayJones,项目名称:iods,代码行数:58,代码来源:lpevents.c


示例14: srecorder_unregister_external_log

/**
    @function: int srecorder_unregister_external_log(unsigned id)
    @brief: 
    @param: 
    @return: 
    @note:
**/
int srecorder_unregister_external_log(unsigned id)
{
    log_registration_entry_t* prev_entry = NULL;
    log_registration_entry_t* curr_entry = NULL;

    if (spin_trylock(&srecorder_registration_lock) == 0)
    {
        return -1;
    }

    if (spin_trylock(&srecorder_list_lock) == 0)
    {
        goto reg_out;
    }

    curr_entry = p_log_registration_list;
    while (curr_entry != NULL)
    {
        if (curr_entry->info.log_id == id)
        {
            if (curr_entry == p_log_registration_list)
            {
                p_log_registration_list =  curr_entry->next;
            }
            else
            {
                prev_entry->next = curr_entry->next;
            }

            spin_unlock(&srecorder_list_lock);
            spin_unlock(&srecorder_registration_lock);
            kfree(curr_entry);
            return 0;
        }

        prev_entry = curr_entry;
        curr_entry = curr_entry->next;
    }

    /* return if nothing found in loop */
    spin_unlock(&srecorder_list_lock);
reg_out:
    spin_unlock(&srecorder_registration_lock);
    return -1;
}
开发者ID:Nothing-Dev,项目名称:android_kernel_huawei_hwY635,代码行数:52,代码来源:srecorder_interface.c


示例15: smp_make_wrapper

handler_wrapper_t*
smp_make_wrapper()
{
	int i;
	for(i = 0; i < sizeof(wrapper_pool)/sizeof(wrapper_pool[0]); i++)
		if(spin_trylock(&wrapper_pool[i].lock) == 0)
			return &wrapper_pool[i];
	return NULL;
}
开发者ID:kstraube,项目名称:hysim,代码行数:9,代码来源:smp.c


示例16: ctr_paes_crypt

static int ctr_paes_crypt(struct blkcipher_desc *desc, unsigned long modifier,
			  struct blkcipher_walk *walk)
{
	struct s390_paes_ctx *ctx = crypto_blkcipher_ctx(desc->tfm);
	u8 buf[AES_BLOCK_SIZE], *ctrptr;
	unsigned int nbytes, n, k;
	int ret, locked;

	locked = spin_trylock(&ctrblk_lock);

	ret = blkcipher_walk_virt_block(desc, walk, AES_BLOCK_SIZE);
	while ((nbytes = walk->nbytes) >= AES_BLOCK_SIZE) {
		n = AES_BLOCK_SIZE;
		if (nbytes >= 2*AES_BLOCK_SIZE && locked)
			n = __ctrblk_init(ctrblk, walk->iv, nbytes);
		ctrptr = (n > AES_BLOCK_SIZE) ? ctrblk : walk->iv;
		k = cpacf_kmctr(ctx->fc | modifier, ctx->pk.protkey,
				walk->dst.virt.addr, walk->src.virt.addr,
				n, ctrptr);
		if (k) {
			if (ctrptr == ctrblk)
				memcpy(walk->iv, ctrptr + k - AES_BLOCK_SIZE,
				       AES_BLOCK_SIZE);
			crypto_inc(walk->iv, AES_BLOCK_SIZE);
			ret = blkcipher_walk_done(desc, walk, nbytes - n);
		}
		if (k < n) {
			if (__ctr_paes_set_key(ctx) != 0) {
				if (locked)
					spin_unlock(&ctrblk_lock);
				return blkcipher_walk_done(desc, walk, -EIO);
			}
		}
	}
	if (locked)
		spin_unlock(&ctrblk_lock);
	/*
	 * final block may be < AES_BLOCK_SIZE, copy only nbytes
	 */
	if (nbytes) {
		while (1) {
			if (cpacf_kmctr(ctx->fc | modifier,
					ctx->pk.protkey, buf,
					walk->src.virt.addr, AES_BLOCK_SIZE,
					walk->iv) == AES_BLOCK_SIZE)
				break;
			if (__ctr_paes_set_key(ctx) != 0)
				return blkcipher_walk_done(desc, walk, -EIO);
		}
		memcpy(walk->dst.virt.addr, buf, nbytes);
		crypto_inc(walk->iv, AES_BLOCK_SIZE);
		ret = blkcipher_walk_done(desc, walk, 0);
	}

	return ret;
}
开发者ID:BWhitten,项目名称:linux-stable,代码行数:56,代码来源:paes_s390.c


示例17: iprintcanlock

static int iprintcanlock(spinlock_t * l)
{
    int i;

    for (i = 0; i < 1000; i++) {
        if (spin_trylock(l))
            return 1;
    }
    return 0;
}
开发者ID:ihategit,项目名称:akaros,代码行数:10,代码来源:cons.c


示例18: stop_machine_run

int stop_machine_run(int (*fn)(void *), void *data, unsigned int cpu)
{
    cpumask_t allbutself;
    unsigned int i, nr_cpus;
    int ret;

    BUG_ON(!local_irq_is_enabled());

    allbutself = cpu_online_map;
    cpu_clear(smp_processor_id(), allbutself);
    nr_cpus = cpus_weight(allbutself);

    if ( nr_cpus == 0 )
    {
        BUG_ON(cpu != smp_processor_id());
        return (*fn)(data);
    }

    /* Note: We shouldn't spin on lock when it's held by others since others
     * is expecting this cpus to enter softirq context. Or else deadlock
     * is caused.
     */
    if ( !spin_trylock(&stopmachine_lock) )
        return -EBUSY;

    stopmachine_data.fn = fn;
    stopmachine_data.fn_data = data;
    stopmachine_data.nr_cpus = nr_cpus;
    stopmachine_data.fn_cpu = cpu;
    atomic_set(&stopmachine_data.done, 0);
    stopmachine_data.state = STOPMACHINE_START;

    smp_wmb();

    for_each_cpu_mask ( i, allbutself )
        cpu_raise_softirq(i, STOPMACHINE_SOFTIRQ);

    stopmachine_set_state(STOPMACHINE_PREPARE);

    local_irq_disable();
    stopmachine_set_state(STOPMACHINE_DISABLE_IRQ);

    if ( cpu == smp_processor_id() )
        stopmachine_data.fn_result = (*fn)(data);
    stopmachine_set_state(STOPMACHINE_INVOKE);
    ret = stopmachine_data.fn_result;

    stopmachine_set_state(STOPMACHINE_EXIT);
    local_irq_enable();

    spin_unlock(&stopmachine_lock);

    return ret;
}
开发者ID:a2k2,项目名称:xen-unstable,代码行数:54,代码来源:stop_machine.c


示例19: dump_smp_call_function

/*
 * dump version of smp_call_function to avoid deadlock in call_lock
 */
void dump_smp_call_function (void (*func) (void *info), void *info)
{
	static struct call_data_struct dumpdata;
	static int dumping_cpu = -1;
	int waitcount;

	spin_lock(&dump_call_lock);
	/*
	 * The cpu that reaches here first will do dumping.  Only the dumping
	 * cpu skips the if-statement below ONLY ONCE.  The other cpus freeze
	 * themselves here.
	 */
	if (dumpdata.func) {
		spin_unlock(&dump_call_lock);
		/*
		 * The dumping cpu reaches here in case that the netdump starts
		 * after the diskdump fails.  In the case, the dumping cpu
		 * needs to return to continue the netdump.  In other cases,
		 * freezes itself by calling func().
		 */
		if (dumping_cpu == smp_processor_id())
			return;

		func(info);
		for (;;);
		/* NOTREACHED */
	}

	dumping_cpu = smp_processor_id();

	/* freeze call_lock or wait for on-going IPIs to settle down */
	waitcount = 0;
	while (!spin_trylock(&call_lock)) {
		if (waitcount++ > 1000) {
			/* save original for dump analysis */
			saved_call_data = call_data;
			break;
		}
		udelay(1000);
		barrier();
	}

	dumpdata.func = func;
	dumpdata.info = info;
	dumpdata.wait = 0; /* not used */
	atomic_set(&dumpdata.started, 0); /* not used */
	atomic_set(&dumpdata.finished, 0); /* not used */

	call_data = &dumpdata;
	mb();
	send_IPI_allbutself(IPI_CALL_FUNC);
	/* Don't wait */
	spin_unlock(&dump_call_lock);
}
开发者ID:dduval,项目名称:kernel-rhel3,代码行数:57,代码来源:smp.c


示例20: mv_otg_resume

static int mv_otg_resume(struct platform_device *dev)
{
	struct mv_otg *mvotg = platform_get_drvdata(dev);

	if (spin_trylock(&mvotg->wq_lock)) {
		mv_otg_run_state_machine(mvotg, 0);
		spin_unlock(&mvotg->wq_lock);
	}

	return 0;
}
开发者ID:Akheon23,项目名称:chromecast-mirrored-source.kernel,代码行数:11,代码来源:mv_otg.c



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ spin_unlock函数代码示例发布时间:2022-05-30
下一篇:
C++ spin_lock_irqsave函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap