blob: 4bfdd8c93e19e933d2e2baf9bc2f4aedaf80e6b7 (
plain)
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
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
|
---@meta
---
---Provides threading capabilities.
---@class thread
thread = {}
---
---A thread object.
---@class thread.Thread
thread.Thread = {}
---
---A channel object.
---@class thread.Channel
thread.Channel = {}
---
---Create a new thread and starts it.
---
---@param name string
---@param callback function
---@param ...? string|boolean|number|table|nil Optional arguments passed to callback
---
---@return thread.Thread|nil
---@return string errorMessage
function thread.create(name, callback, ...) end
---
---Creates a new channel or retrieve existing one.
---
---@param name string
---
---@return thread.Channel|nil
---@return string errorMessage
function thread.get_channel(name) end
---
---Get the number of CPU cores available.
---
---Returns the total number of logical CPU cores. On CPUs that include
---technologies such as hyperthreading, the number of logical cores may be
---more than the number of physical cores.
---
---@return number
function thread.get_cpu_count() end
---
---Get the id of a thread.
---
---@return integer
function thread.Thread:get_id() end
---
---Get the name assigned to a thread.
---
---@return string
function thread.Thread:get_name() end
---
---Wait for a thread to finish and get the return code.
---
---@return integer
function thread.Thread:wait() end
---
---Metamethod to automatically compare two threads.
---
---@param thread1 thread.Thread
---@param thread2 thread.Thread
---
---@return boolean
function thread.Thread:__eq(thread1, thread2) end
---
---Metamethod that automatically converts a thread to a string representation.
---
---@return string
function thread.Thread:__tostring() end
---
---Get the first element of the list in the channel.
---
---@return string|boolean|number|table|nil
function thread.Channel:first() end
---
---Get the last element of the list in the channel.
---
---@return string|boolean|number|table|nil
function thread.Channel:last() end
---
---Add a new element to the end of a channel list.
---
---@param element string|boolean|number|table|nil
---
---@return boolean|nil
---@return string errorMessage
function thread.Channel:push(element) end
---
---Add a new element to the end of a channel list and waits for thread to read it.
---
---@param element string|boolean|number|table|nil
---
---@return boolean | nil
---@return string errorMessage
function thread.Channel:supply(element) end
---
---Remove all elements from the channel.
function thread.Channel:clear() end
---
---Remove the first element of a channel.
function thread.Channel:pop() end
---
---Wait until the channel has one element and return it.
---
---@return string|boolean|number|table|nil
function thread.Channel:wait() end
---
---Metamethod that automatically converts a channel to a string representation.
---
---@return string
function thread.Channel:__tostring() end
return thread
|