enable interrupts
#include <i86.h> void _enable( void );
The _enable() function causes interrupts to become enabled. It's used in conjunction with the _disable() function to make sure that a sequence of instructions is executed without any intervening interruptions.
#include <stdio.h>
#include <stdlib.h>
#include <i86.h>
struct list_entry {
struct list_entry *next;
int data;
};
struct list_entry *ListHead = NULL;
struct list_entry *ListTail = NULL;
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 */
}
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 );
}
}
Intel
| Safety: | |
|---|---|
| Interrupt handler | Yes |
| Signal handler | Yes |
| Thread | Yes |
When you use the _enable() function, your program must be linked for privity level 1, and the process must be run by the superuser (root). For more information on privity, see