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

C++ intr_disable函数代码示例

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

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



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

示例1: sema_up

/* Up or "V" operation on a semaphore.  Increments SEMA's value
   and wakes up one thread of those waiting for SEMA, if any.

   This function may be called from an interrupt handler. */
void
sema_up (struct semaphore *sema)
{
  enum intr_level old_level;

  ASSERT (sema != NULL);

  old_level = intr_disable ();

  if (!list_empty (&(sema->waiters))) {
    thread_unblock (list_entry (list_pop_highest_priority (&(sema->waiters)),
                                struct thread, elem));
  }
开发者ID:swapys7,项目名称:OS-Proj_1,代码行数:17,代码来源:synch.c


示例2: serial_init_queue

/*! Initializes the serial port device for queued interrupt-driven
    I/O.  With interrupt-driven I/O we don't waste CPU time
    waiting for the serial device to become ready. */
void serial_init_queue(void) {
    enum intr_level old_level;

    if (mode == UNINIT)
        init_poll();
    ASSERT(mode == POLL);

    intr_register_ext(0x20 + 4, serial_interrupt, "serial");
    mode = QUEUE;
    old_level = intr_disable();
    write_ier();
    intr_set_level(old_level);
}
开发者ID:IcyInsanities,项目名称:CS101B,代码行数:16,代码来源:serial.c


示例3: timer_sleep

/*! Sleeps for approximately TICKS timer ticks.  Interrupts must
    be turned on. */
void timer_sleep(int64_t ticks) {
    int64_t start = timer_ticks();
    enum intr_level old_level;
    
    ASSERT(intr_get_level() == INTR_ON);
    old_level = intr_disable();
    
    thread_sleep();
    thread_current()->wake_time = start + ticks;
    thread_block();

    intr_set_level(old_level);
}
开发者ID:jerryxzhang,项目名称:Kernel-Sanders,代码行数:15,代码来源:timer.c


示例4: __mp_unlock

void
__mp_unlock(struct __mp_lock *mpl)
{
	struct __mp_lock_cpu *cpu = &mpl->mpl_cpus[cpu_number()];
	u_int64_t s;

	s = intr_disable();
	if (--cpu->mplc_depth == 0) {
		mpl->mpl_ticket++;
		sparc_membar(StoreStore | LoadStore);
	}
	intr_restore(s);
}
开发者ID:orumin,项目名称:openbsd-efivars,代码行数:13,代码来源:lock_machdep.c


示例5: timer_sleep

/* Sleeps for approximately TICKS timer ticks.  Interrupts must
   be turned on. */
void
timer_sleep (int64_t ticks) 
{
  ASSERT (intr_get_level () == INTR_ON);
  enum intr_level level = intr_disable();
  if(ticks > 0)
  {
    thread_current()->sleep_time = ticks;
    thread_block();
  }
  intr_set_level(level);

}
开发者ID:codem3up,项目名称:OS-PA2,代码行数:15,代码来源:timer.c


示例6: sema_up

/* Up or "V" operation on a semaphore.  Increments SEMA's value
   and wakes up one thread of those waiting for SEMA, if any.

   This function may be called from an interrupt handler. */
void
sema_up (struct semaphore *sema)
{
    enum intr_level old_level;
    ASSERT (sema != NULL);
    old_level = intr_disable ();

    if (!list_empty (&sema->waiters)) {
        list_sort (&sema->waiters, (list_less_func *) &compare_priority, NULL);
        struct thread *waiter_thread = list_entry (list_pop_front (&sema->waiters),
                                       struct thread, elem);
        thread_unblock (waiter_thread);
    }
开发者ID:tushar2702,项目名称:OperatingSystem,代码行数:17,代码来源:synch.c


示例7: spinlock_enter

void
spinlock_enter(void)
{
	struct thread *td;

	td = curthread;
	if (td->td_md.md_spinlock_count == 0) {
		td->td_md.md_spinlock_count = 1;
		td->td_md.md_saved_sstatus_ie = intr_disable();
	} else
		td->td_md.md_spinlock_count++;
	critical_enter();
}
开发者ID:hmatyschok,项目名称:MeshBSD,代码行数:13,代码来源:machdep.c


示例8: main

int main(void) {
  // register exception handlers
  for (unsigned i = 0; i < 32; i++) {
	exc_register(i, &fault_handler);
  }
  exc_register(8, &trap_handler);
  exc_register(18, &intr_handler);
  exc_register(19, &intr_handler);
  exc_register(20, &intr_handler);
  exc_register(21, &intr_handler);

  // unmask interrupts
  intr_unmask_all();
  // clear pending flags
  intr_clear_all_pending();
  // enable interrupts
  intr_enable();

  // a that prints "@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_" N times and does some self-checking
  volatile unsigned starts = 0;
  volatile unsigned ends = 0;
  volatile unsigned sent = 0;

  for (unsigned k = 0; k < N; k++) {
    starts++;
    for (unsigned i = 0; i < 32; i++) {
      putchar('@'+i);
      sent+=i;
    }
    putchar('\n');
    ends++;

    if (sent != 496*(k+1) || starts != ends) {
      LEDS = 0x55;
      abort();
    }
  }

  // diable interrupts again
  intr_disable();
  
  // call exception vector number 8
  trap(8);

  // trigger illegal operation fault
  asm volatile(".word 0xffffffff"); // illegal operation
  // trigger illegal memory access fault, never reached
  (*((volatile _IODEV unsigned *)0xffffffff)) = 0;

  return 0;
}
开发者ID:alexjordan,项目名称:patmos,代码行数:51,代码来源:intrs.c


示例9: __mp_release_all_but_one

int
__mp_release_all_but_one(struct __mp_lock *mpl)
{
	struct __mp_lock_cpu *cpu = &mpl->mpl_cpus[cpu_number()];
	u_int64_t s;
	int rv;

	s = intr_disable();
	rv = cpu->mplc_depth;
	cpu->mplc_depth = 1;
	intr_restore(s);

	return (rv - 1);
}
开发者ID:orumin,项目名称:openbsd-efivars,代码行数:14,代码来源:lock_machdep.c


示例10: __mp_lock

void
__mp_lock(struct __mp_lock *mpl)
{
	struct __mp_lock_cpu *cpu = &mpl->mpl_cpus[cpu_number()];
	u_int64_t s;

	s = intr_disable();
	if (cpu->mplc_depth++ == 0)
		cpu->mplc_ticket = atomic_inc_int_nv(&mpl->mpl_users);
	intr_restore(s);

	__mp_lock_spin(mpl, cpu->mplc_ticket);
	sparc_membar(LoadLoad | LoadStore);
}
开发者ID:orumin,项目名称:openbsd-efivars,代码行数:14,代码来源:lock_machdep.c


示例11: timer_sleep

/* Sleeps for approximately TICKS timer ticks.  Interrupts must
   be turned on. */
void
timer_sleep (int64_t ticks)
{
  int64_t start = timer_ticks ();

  ASSERT (intr_get_level () == INTR_ON);
  enum intr_level old_level = intr_disable ();

  // sleep the thread for `ticks` seconds,
  // until the tick becomes [start + ticks]
  thread_sleep_until (start + ticks);

  intr_set_level (old_level);
}
开发者ID:chutchUCD,项目名称:OS,代码行数:16,代码来源:timer.c


示例12: dismiss_alarm

/* dismiss the alarm and unblock the thread */
static void
dismiss_alarm (struct alarm *alrm)
{
  enum intr_level old_level;
  
  ASSERT (is_alarm (alrm));
  
  /* remove from alarm_list, critical section */
  old_level = intr_disable ();
  list_remove (&alrm->elem);
  
  thread_unblock (alrm->thrd); /* unblock the thread */
  intr_set_level (old_level);
}
开发者ID:10132510143cai,项目名称:OS15x133_143_144_145,代码行数:15,代码来源:alarm.c


示例13: sema_down

/*! Down or "P" operation on a semaphore.  Waits for SEMA's value
    to become positive and then atomically decrements it.

    This function may sleep, so it must not be called within an
    interrupt handler.  This function may be called with
    interrupts disabled, but if it sleeps then the next scheduled
    thread will probably turn interrupts back on. */
void sema_down(struct semaphore *sema) {
    enum intr_level old_level;

    ASSERT(sema != NULL);
    ASSERT(!intr_context());

    old_level = intr_disable();
    while (sema->value == 0) {
        list_push_back(&sema->waiters, &thread_current()->elem);
        thread_block();
    }
    sema->value--;
    intr_set_level(old_level);
}
开发者ID:waffleOS,项目名称:waffle,代码行数:21,代码来源:synch.c


示例14: timer_sleep

/* Sleeps for approximately TICKS timer ticks.  Interrupts must
   be turned on. */
void
timer_sleep (int64_t ticks) 
{
  enum intr_level old_level;
  ASSERT (intr_get_level () == INTR_ON);

  if (ticks > 0)
  {
    thread_current ()->sleep_ticks = ticks;
    old_level = intr_disable ();
    thread_block ();
    intr_set_level (old_level);
  }
}
开发者ID:iagui005,项目名称:cs153project1,代码行数:16,代码来源:timer.c


示例15: timer_sleep

/* Sleeps for approximately TICKS timer ticks.  Interrupts must
   be turned on. */
void
timer_sleep (int64_t ticks) 
{
  ASSERT (intr_get_level () == INTR_ON);

  /* ousiri */
  if(ticks>0)
  {
    struct thread *cur = thread_current ();
    cur->sleeping_ticks = ticks;
    enum intr_level old_intr_level = intr_disable ();
    thread_block ();
    intr_set_level (old_intr_level);
  }
}
开发者ID:Kevin12353,项目名称:sysu-os-team4,代码行数:17,代码来源:timer.c


示例16: sema_up

/* Up or "V" operation on a semaphore.  Increments SEMA's value
   and wakes up one thread of those waiting for SEMA, if any.

   This function may be called from an interrupt handler. */
void
sema_up (struct semaphore *sema) 
{
  enum intr_level old_level;
  struct thread * wakeup_thread = NULL;

  ASSERT (sema != NULL);

  old_level = intr_disable ();
  
  if (!list_empty (&sema->waiters)) {
    wakeup_thread = list_entry (list_pop_front (&sema->waiters),
    				struct thread, elem);
    thread_unblock (wakeup_thread);
  }
开发者ID:johnmiked15,项目名称:PintOS,代码行数:19,代码来源:synch.c


示例17: sema_up

/* Up or "V" operation on a semaphore.  Increments SEMA's value
   and wakes up one thread of those waiting for SEMA, if any.

   This function may be called from an interrupt handler. */
void
sema_up (struct semaphore *sema) 
{
	enum intr_level old_level;
	ASSERT (sema != NULL);

	old_level = intr_disable ();
	if (!list_empty (&sema->waiters))
	{
		//unblock the waiting thread with the highest priority
		//struct thread *max_waiting_thread = list_entry(list_max(&sema->waiters, left_less_than_right, NULL), struct thread, elem);
		//list_remove(&max_waiting_thread->elem);
		//thread_unblock(max_waiting_thread); 
		thread_unblock(list_entry(list_pop_front(&sema->waiters), struct thread, elem));
	}
开发者ID:ykamo001,项目名称:PintOS,代码行数:19,代码来源:synch.c


示例18: init_profile_clock

/*===========================================================================*
 *			init_profile_clock				     *
 *===========================================================================*/
PUBLIC void init_profile_clock(u32_t freq)
{
  int r, irq;

  intr_disable();

  if((irq = arch_init_profile_clock(freq)) >= 0) {
	/* Register interrupt handler for statistical system profiling.  */
	profile_clock_hook.proc_nr_e = CLOCK;
	put_irq_handler(&profile_clock_hook, irq, profile_clock_handler);
	enable_irq(&profile_clock_hook);
  }

  intr_enable();
}
开发者ID:Compy,项目名称:Minix,代码行数:18,代码来源:profile.c


示例19: sema_up

/* Up or "V" operation on a semaphore.  Increments SEMA's value
   and wakes up one thread of those waiting for SEMA, if any.

   This function may be called from an interrupt handler. */
void
sema_up (struct semaphore *sema) 
{
  enum intr_level old_level;
  ASSERT (sema != NULL);
  old_level = intr_disable ();
  sema->value++;
  if (!list_empty (&sema->waiters))
   {
     struct list_elem *e = list_max (&sema->waiters, priority_less, NULL);
     list_remove (e);
     thread_unblock(list_entry (e, struct thread, elem));
   }
  intr_set_level (old_level);
}
开发者ID:snagrajn,项目名称:from-pintos-to-burritos,代码行数:19,代码来源:synch.c


示例20: alarm_check

void alarm_check(void) {
  struct alarm* al;
  enum intr_level old_level;


  old_level = intr_disable();

  if (!list_empty(&alarms)) {
    al = list_entry(list_begin(&alarms), struct alarm, elem);

    if (al->expiration < timer_ticks()) {
      list_remove(&al->elem);
      thread_unblock(al->th);
    }
  }
开发者ID:nem0301,项目名称:OS,代码行数:15,代码来源:alarm.c



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
C++ intr_establish函数代码示例发布时间:2022-05-30
下一篇:
C++ intr_context函数代码示例发布时间: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