/* Copyright 2003-2014 James F. Duff */
/* License and disclaimer: http://www.eight-cubed.com/disclaimer.html */

#define __NEW_STARLET 1

#include <stdio.h>
#include <stdlib.h>
#include <ssdef.h>
#include <stsdef.h>
#include <sysevtdef.h>
#include <psldef.h>
#include <lib$routines.h>
#include <starlet.h>

#include "errchk.h"


/******************************************************************************/
static void add_active_cpu_ast (void) {

    (void)printf ("A CPU was added to the active set\n");
}


/******************************************************************************/
static void del_active_cpu_ast (void) {

    (void)printf ("A CPU was deleted from the active set\n");
}


/******************************************************************************/
int main (void) {

#ifdef __VAX
#  error "Alpha/IA64 specific code"
#endif /* __VAX */

static unsigned __int64 add_act_cpu_handle;
static unsigned __int64 del_act_cpu_handle;

static int r0_status;

    r0_status = sys$set_system_event (SYSEVT$C_ADD_ACTIVE_CPU,
                                      add_active_cpu_ast,
                                      0,
                                      PSL$C_USER,
                                      SYSEVT$M_REPEAT_NOTIFY,
                                      &add_act_cpu_handle);
    errchk_sig (r0_status);

    r0_status = sys$set_system_event (SYSEVT$C_DEL_ACTIVE_CPU,
                                      del_active_cpu_ast,
                                      0,
                                      PSL$C_USER,
                                      SYSEVT$M_REPEAT_NOTIFY,
                                      &del_act_cpu_handle);
    errchk_sig (r0_status);

    r0_status = sys$clear_system_event (&del_act_cpu_handle,
                                        PSL$C_USER,
                                        0);
    errchk_sig (r0_status);

    /*
    ** Once the event ASTs are established, you would normally wait here with
    ** some form of wait call (e.g., $HIBER or $WAITFR) for events to occur.
    */
}

Back to the master examples list.