⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 _disable.gml

📁 开放源码的编译器open watcom 1.6.0版的源代码
💻 GML
字号:
.func _disable
#include <i86.h>
void _disable( void );
.ixfunc2 '&Interrupt' &func
.funcend
.desc begin
The &func function causes interrupts to become disabled.
.np
The &func function would be used in conjunction with the
.kw _enable
function to make sure that a sequence of instructions are executed
without any intervening interrupts occurring.
.im privity
.desc end
.return begin
The &func function returns no value.
.return end
.see begin
.seelist _disable _enable
.see end
.exmp begin
#include <stdio.h>
#include <stdlib.h>
#include <i86.h>
.exmp break
struct list_entry {
    struct list_entry *next;
    int    data;
};
volatile struct list_entry *ListHead = NULL;
volatile struct list_entry *ListTail = NULL;
.exmp break
void insert( struct list_entry *new_entry )
  {
    /* insert new_entry at end of linked list */
    new_entry->next = NULL;
    _disable();       /* disable interrupts */
    if( ListTail == NULL ) {
      ListHead = new_entry;
    } else {
      ListTail->next = new_entry;
    }
    ListTail = new_entry;
    _enable();        /* enable interrupts now */
  }
.exmp break
void main()
  {
    struct list_entry *p;
    int i;

    for( i = 1; i <= 10; i++ ) {
      p = (struct list_entry *)
          malloc( sizeof( struct list_entry ) );
      if( p == NULL ) break;
      p->data = i;
      insert( p );
    }
  }
.exmp end
.class Intel
.system

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -