PreviousUpNext

15.4.912  src/lib/src/lib/thread-kit/src/core-thread-kit/threadkit-debug.pkg

## threadkit-debug.pkg
#
# Debugging support for the threadkit core.

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



stipulate
    package itt =  internal_threadkit_types;                                            # internal_threadkit_types              is from   src/lib/src/lib/thread-kit/src/core-thread-kit/internal-threadkit-types.pkg
    package tim =  time;                                                                # time                                  is from   src/lib/std/time.pkg
    package uns =  unsafe;                                                              # unsafe                                is from   src/lib/std/src/unsafe/unsafe.pkg
    #
    package ci  =  unsafe::mythryl_callable_c_library_interface;                        # unsafe                                is from   src/lib/std/src/unsafe/unsafe.pkg
    #
    fun cfun  fun_name
        = 
        ci::find_c_function
          {
            lib_name => "heap",                                                         # heap                                  is from   src/c/lib/heap/libmythryl-heap.c
            fun_name
          };
            ###############################################################
            # The functions in this package should be called with miminal
            # delay and minimal disturbance of the heap and system state.
            #
            # Consequently I'm not taking the time and effort to switch it
            # over from using find_c_function() to using find_c_function'().
            #                              -- 2012-04-25 CrT
herein

    package  threadkit_debug
    : (weak) Threadkit_Debug                                                            # Threadkit_Debug                       is from   src/lib/src/lib/thread-kit/src/core-thread-kit/threadkit-debug.api
    {
        say_debug =   cfun "debug" :   String -> Void;                                  # debug                                 def in    src/c/lib/heap/libmythryl-heap.c
        #
        fun say_debug_ts  msg
            =
            say_debug (cat ["[", tim::format 3 (tim::get_current_time_utc ()), "] ", msg]);

        get_current_thread =   uns::get_current_thread_register :   Void -> itt::Microthread;
            

        fun say_debug_id  msg
            =
            say_debug (cat [  itt::get_thread's_id_as_string (get_current_thread()), " ", msg  ]);
    };
end;


## COPYRIGHT (c) 1989-1991 John H. Reppy
## COPYRIGHT (c) 1995 AT&T Bell Laboratories.
## Subsequent changes by Jeff Prothero Copyright (c) 2010-2013,
## released per terms of SMLNJ-COPYRIGHT.


Comments and suggestions to: bugs@mythryl.org

PreviousUpNext