-
Notifications
You must be signed in to change notification settings - Fork 10
Expand file tree
/
Copy pathThreading.fs
More file actions
80 lines (72 loc) · 3.26 KB
/
Threading.fs
File metadata and controls
80 lines (72 loc) · 3.26 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
/// Type bindings for Python threading module: https://docs.python.org/3/library/threading.html
module Fable.Python.Threading
open Fable.Core
// fsharplint:disable MemberNames
[<Erase>]
type IExports =
/// Return the 'thread identifier' of the current thread
/// See https://docs.python.org/3/library/threading.html#threading.get_ident
abstract get_ident: unit -> int
/// Return the main Thread object
/// See https://docs.python.org/3/library/threading.html#threading.main_thread
abstract main_thread: unit -> Thread
/// Return the current Thread object
/// See https://docs.python.org/3/library/threading.html#threading.current_thread
abstract current_thread: unit -> Thread
/// Return the number of Thread objects currently alive
/// See https://docs.python.org/3/library/threading.html#threading.active_count
abstract active_count: unit -> int
/// Return a list of all Thread objects currently active
/// See https://docs.python.org/3/library/threading.html#threading.enumerate
abstract enumerate: unit -> Thread list
/// Return a new thread-local data object
/// See https://docs.python.org/3/library/threading.html#threading.local
abstract local: unit -> obj
/// A thread of execution
/// See https://docs.python.org/3/library/threading.html#threading.Thread
and [<Import("Thread", "threading")>] Thread(?target: unit -> unit, ?name: string, ?daemon: bool) =
/// Start the thread's activity
member _.start() : unit = nativeOnly
/// Wait until the thread terminates
member _.join(?timeout: float) : unit = nativeOnly
/// A boolean value indicating whether this thread is a daemon thread
member _.daemon: bool = nativeOnly
/// The thread's name
member _.name: string = nativeOnly
/// The 'thread identifier' of this thread
member _.ident: int option = nativeOnly
/// Whether the thread is alive
member _.is_alive() : bool = nativeOnly
/// A lock object (mutual exclusion)
/// See https://docs.python.org/3/library/threading.html#threading.Lock
[<Import("Lock", "threading")>]
type Lock() =
/// Acquire the lock
member _.acquire(?blocking: bool, ?timeout: float) : bool = nativeOnly
/// Release the lock
member _.release() : unit = nativeOnly
/// Return whether the lock is locked
member _.locked() : bool = nativeOnly
/// A reentrant lock object
/// See https://docs.python.org/3/library/threading.html#threading.RLock
[<Import("RLock", "threading")>]
type RLock() =
/// Acquire the lock
member _.acquire(?blocking: bool, ?timeout: float) : bool = nativeOnly
/// Release the lock
member _.release() : unit = nativeOnly
/// An event object for thread synchronization
/// See https://docs.python.org/3/library/threading.html#threading.Event
[<Import("Event", "threading")>]
type Event() =
/// Set the internal flag to true
member _.set() : unit = nativeOnly
/// Reset the internal flag to false
member _.clear() : unit = nativeOnly
/// Return true if and only if the internal flag is true
member _.is_set() : bool = nativeOnly
/// Block until the internal flag is true or timeout
member _.wait(?timeout: float) : bool = nativeOnly
/// Threading module access and utilities
[<ImportAll("threading")>]
let threading: IExports = nativeOnly