-
Notifications
You must be signed in to change notification settings - Fork 10
Expand file tree
/
Copy pathQueue.fs
More file actions
91 lines (82 loc) · 5.06 KB
/
Queue.fs
File metadata and controls
91 lines (82 loc) · 5.06 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
81
82
83
84
85
86
87
88
89
90
91
/// Type bindings for Python queue module: https://docs.python.org/3/library/queue.html
module Fable.Python.Queue
open Fable.Core
// fsharplint:disable MemberNames
[<Import("Queue", "queue")>]
type Queue<'T>() =
/// Return the approximate size of the queue. Note, qsize() > 0 doesn't guarantee that a subsequent get() will not
/// block, nor will qsize() < maxsize guarantee that put() will not block.
member x.qsize() : int = nativeOnly
/// Return True if the queue is empty, False otherwise. If empty() returns True it doesn't guarantee that a
/// subsequent call to put() will not block. Similarly, if empty() returns False it doesn't guarantee that a
/// subsequent call to get() will not block.
member x.empty() : bool = nativeOnly
/// Return True if the queue is full, False otherwise. If full() returns True it doesn't guarantee that a subsequent
/// call to get() will not block. Similarly, if full() returns False it doesn't guarantee that a subsequent call to
/// put() will not block.
member x.full() : bool = nativeOnly
/// Put item into the queue. If optional args block is true and timeout is None (the default), block if necessary
/// until a free slot is available. If timeout is a positive number, it blocks at most timeout seconds and raises
/// the Full exception if no free slot was available within that time. Otherwise (block is false), put an item on
/// the queue if a free slot is immediately available, else raise the Full exception (timeout is ignored in that
/// case).
member x.put(item: 'T, ?block: bool, ?timeout: float) : unit = nativeOnly
/// Remove and return an item from the queue. If optional args block is true and timeout is None (the default),
/// block if necessary until an item is available. If timeout is a positive number, it blocks at most timeout
/// seconds and raises the Empty exception if no item was available within that time. Otherwise (block is false),
/// return an item if one is immediately available, else raise the Empty exception (timeout is ignored in that
/// case).
///
/// Prior to 3.0 on POSIX systems, and for all versions on Windows, if block is true and timeout is None, this
/// operation goes into an uninterruptible wait on an underlying lock. This means that no exceptions can occur, and
/// in particular a SIGINT will not trigger a KeyboardInterrupt.
member x.get(?block: bool, ?timeout: float) : 'T = nativeOnly
/// Equivalent to get(False).
/// See https://docs.python.org/3/library/queue.html#queue.Queue.get_nowait
[<Emit("$0.get_nowait()")>]
member x.get_nowait() : 'T = nativeOnly
/// Blocks until all items in the queue have been gotten and processed.
///
/// The count of unfinished tasks goes up whenever an item is added to the queue. The count goes down whenever a
/// consumer thread calls task_done() to indicate that the item was retrieved and all work on it is complete. When
/// the count of unfinished tasks drops to zero, join() unblocks.
member x.join() : unit = nativeOnly
/// Indicate that a formerly enqueued task is complete
/// See https://docs.python.org/3/library/queue.html#queue.Queue.task_done
member x.task_done() : unit = nativeOnly
/// A priority queue implementation (lowest valued entries are retrieved first)
[<Import("PriorityQueue", "queue")>]
type PriorityQueue<'T>() =
inherit Queue<'T>()
/// A LIFO (stack) queue implementation
[<Import("LifoQueue", "queue")>]
type LifoQueue<'T>() =
inherit Queue<'T>()
[<Import("SimpleQueue", "queue")>]
type SimpleQueue<'T>() =
/// Return the approximate size of the queue. Note, qsize() > 0 doesn't guarantee that a subsequent get() will not
/// block, nor will qsize() < maxsize guarantee that put() will not block.
member x.qsize() : int = nativeOnly
/// Return True if the queue is empty, False otherwise. If empty() returns True it doesn't guarantee that a
/// subsequent call to put() will not block. Similarly, if empty() returns False it doesn't guarantee that a
/// subsequent call to get() will not block.
member x.empty() : bool = nativeOnly
/// Return True if the queue is full, False otherwise. If full() returns True it doesn't guarantee that a subsequent
/// call to get() will not block. Similarly, if full() returns False it doesn't guarantee that a subsequent call to
/// put() will not block.
member x.put(item: 'T, ?block: bool, ?timeout: float) : unit = nativeOnly
/// Remove and return an item from the queue.
member x.get(?block: bool, ?timeout: float) : 'T = nativeOnly
/// Equivalent to get(False).
[<Emit("$0.get_nowait()")>]
member x.get_nowait() : 'T = nativeOnly
/// Exception raised when non-blocking get() is called on an empty Queue
/// See https://docs.python.org/3/library/queue.html#queue.Empty
[<Import("Empty", "queue")>]
type Empty() =
inherit exn()
/// Exception raised when non-blocking put() is called on a full Queue
/// See https://docs.python.org/3/library/queue.html#queue.Full
[<Import("Full", "queue")>]
type Full() =
inherit exn()