プログラミング言語SML#解説 4.0.0版
27 SML#システムライブラリ

27.7 Myth

インタフェイス

structure Myth =
  struct
    type thread (= *)
    structure Thread =
      struct
        type thread = thread
        val create : (unit -> int) -> thread
        val detach : thread -> unit
        val join : thread -> int
        val exit : int -> unit
        val yield : unit -> unit
        val self : unit -> thread
        val equal : thread * thread -> bool
      end
    type mutex (= array)
    structure Mutex =
      struct
        type mutex = mutex
        val create : unit -> mutex
        val lock : mutex -> unit
        val unlock : mutex -> unit
        val trylock : mutex -> bool
        val destroy : mutex -> unit
      end
    type cond (= array)
    structure Cond =
      struct
        type cond = cond
        val create : unit -> cond
        val signal : cond -> unit
        val broadcast : cond -> unit
        val wait : cond * mutex -> unit
        val destroy : cond -> unit
      end
    type barrier (= array)
    structure Barrier =
      struct
        type barrier = barrier
        val create : int -> barrier
        val wait : barrier -> bool
        val destroy : barrier -> unit
      end
  end