Retro video games delivered to your door every month!
Click above to get retro games delivered to your door ever month!
X-Hacker.org- Watcom C/C++ v10.0 : C library - <b>synopsis:</b> http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
Synopsis:
    #include <i86.h>
    void _enable( void );

Description:
    The _enable function causes interrupts to become enabled.

    The _enable function would be used in conjunction with the  _disable
    function to make sure that a sequence of instructions are executed
    without any intervening interrupts occurring.

Returns:
    The _enable function returns no value.

See Also:
    _disable

Example:
    #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 );
        }
      }

Classification:
    Intel

Systems:
    All

Online resources provided by: http://www.X-Hacker.org --- NG 2 HTML conversion by Dave Pearson