PreviousUpNext

15.4.1229  src/lib/std/src/unsafe/software-generated-periodic-events.pkg

## software-generated-periodic-events.pkg
#
# See overview comments in

#     src/lib/std/src/unsafe/software-generated-periodic-events.api

# Compiled by:
#     src/lib/std/src/standard-core.sublib


package   software_generated_periodic_events
: (weak)  Software_Generated_Periodic_Events                                                                    # Software_Generated_Periodic_Events    is from   src/lib/std/src/unsafe/software-generated-periodic-events.api
{
    exception BAD_SOFTWARE_GENERATED_PERIODIC_EVENT_INTERVAL;

    # We default to a dummy handler
    # which does nothing:
    #
    default_periodic_event_handler
        =
        \\ fate =  fate;

                                                                                                                my _ = 
    runtime::software_generated_periodic_event_handler_refcell__global                                          # Ultimately from   src/c/main/construct-runtime-package.c
        :=
        default_periodic_event_handler;


    handler_valid = REF FALSE;


    # Setting this FALSE prevents the
    # handler from being called:
    #
    software_generated_periodic_events_switch_refcell__global
        =
        runtime::software_generated_periodic_events_switch_refcell__global;                                     # Ultimately from   src/c/main/construct-runtime-package.c


    software_generated_periodic_event_interval_refcell__global
        =
        runtime::software_generated_periodic_event_interval_refcell__global;                                    # Ultimately from   src/c/main/construct-runtime-package.c



    fun set_software_generated_periodic_event_handler   NULL
            =>
            {   runtime::software_generated_periodic_event_handler_refcell__global                              # Ultimately from   src/c/main/construct-runtime-package.c
                    :=
                    default_periodic_event_handler;
                #
                handler_valid := FALSE;
            };

        set_software_generated_periodic_event_handler  (THE poll_handler)
            =>
            {   runtime::software_generated_periodic_event_handler_refcell__global                              # Ultimately from   src/c/main/construct-runtime-package.c
                    :=
                    poll_handler;
                #
                handler_valid := TRUE;
            };
    end;



    fun get_software_generated_periodic_event_handler ()
        =
        if *handler_valid   THE *runtime::software_generated_periodic_event_handler_refcell__global;            # Ultimately from   src/c/main/construct-runtime-package.c
        else                NULL;
        fi;



    fun set_software_generated_periodic_event_interval   NULL
            =>
            software_generated_periodic_event_interval_refcell__global                                          # Ultimately from   src/c/main/construct-runtime-package.c
                :=
                0;
        #
        set_software_generated_periodic_event_interval   (THE event_interval)
            =>
            if (event_interval <= 0)
                #
                raise exception BAD_SOFTWARE_GENERATED_PERIODIC_EVENT_INTERVAL;
            else
                software_generated_periodic_event_interval_refcell__global                                      # Ultimately from   src/c/main/construct-runtime-package.c
                    :=
                    event_interval;
            fi;
    end;



    fun get_software_generated_periodic_event_interval ()
        =
        {   poll_interval
                =
                *software_generated_periodic_event_interval_refcell__global;                                    # Ultimately from   src/c/main/construct-runtime-package.c
            #                  
            if (poll_interval == 0)   NULL;
            else                      THE poll_interval;
            fi;
        };
};



## COPYRIGHT (c) 1997 Bell Labs, Lucent Technologies.
## Subsequent changes by Jeff Prothero Copyright (c) 2010-2015,
## released per terms of SMLNJ-COPYRIGHT.


Comments and suggestions to: bugs@mythryl.org

PreviousUpNext