package pyml

  1. Overview
  2. Docs
type t
val ensure : unit -> t

ensure () ensures that the current thread holds the global interpreter lock and hence can call the Python C API in a safe way. Wrapper for PyGILState_Ensure

val release : t -> unit

release t releases any resource acquired by ensure. Wrapper for PyGILState_Release

val check : unit -> bool

check () returns true if the current thread holds the global interpreter lock. Wrapper for PyGILState_Check

val with_lock : (unit -> 'a) -> 'a

with_lock f runs f ensuring that we hold the global interpreter lock to do so. If the lock needs to be acquired it is released once f completes or if f raises an exception.