PreviousUpNext

15.3.391  src/lib/src/lib/thread-kit/src/core-thread-kit/task-junk.api

## task-junk.api
#
# Convenience functions built atop the
#     src/lib/src/lib/thread-kit/src/core-thread-kit/microthread.api
#     src/lib/src/lib/thread-kit/src/core-thread-kit/microthread-preemptive-scheduler.api
# layer, to reduce clutter in the above.

# Compiled by:
#     src/lib/std/standard.lib

stipulate
    package ath =  microthread;                                                 # microthread                   is from   src/lib/src/lib/thread-kit/src/core-thread-kit/microthread.pkg
    package itt =  internal_threadkit_types;                                    # internal_threadkit_types      is from   src/lib/src/lib/thread-kit/src/core-thread-kit/internal-threadkit-types.pkg
herein

    # This api is implemented in:
    #     src/lib/src/lib/thread-kit/src/core-thread-kit/task-junk.pkg

    api Task_Junk {
        #
        state_to_string:    ath::state::State -> String;                        #

        get_or_make_current_cleanup_task: Void -> ath::Apptask;
            #
            # Get the cleanup task for current task,
            # or create it if there isn't one yet:

        note_thread_cleanup_action: (Void -> Void) -> Void;
            #
            # The idea here is a bit like destructors in Java (say):
            # if our thread is using some resource like an X server
            # which should be closed when it dies, then we register
            # a cleanup action this call to do the job.

        note_task_cleanup_action:   (Void -> Void) -> Void;
            #
            # This is like the above except that the job runs
            # when the current task terminates instead of
            # when the current thread terminates.
    };
end;

## By Jeff Prothero Copyright (c) 2012-2012,
## released per terms of SMLNJ-COPYRIGHT.


Comments and suggestions to: bugs@mythryl.org

PreviousUpNext