diff options
Diffstat (limited to 'meta/3rd/love2d/library/love/thread.lua')
-rw-r--r-- | meta/3rd/love2d/library/love/thread.lua | 57 |
1 files changed, 57 insertions, 0 deletions
diff --git a/meta/3rd/love2d/library/love/thread.lua b/meta/3rd/love2d/library/love/thread.lua index cf37b411..90cf4c5f 100644 --- a/meta/3rd/love2d/library/love/thread.lua +++ b/meta/3rd/love2d/library/love/thread.lua @@ -9,12 +9,18 @@ --- ---When a Thread is started, it only loads the love.thread module. Every other module has to be loaded with require. --- +--- +---[Open in Browser](https://love2d.org/wiki/love.thread) +--- ---@class love.thread love.thread = {} --- ---Creates or retrieves a named thread channel. --- +--- +---[Open in Browser](https://love2d.org/wiki/love.thread.getChannel) +--- ---@param name string # The name of the channel you want to create or retrieve. ---@return love.Channel channel # The Channel object associated with the name. function love.thread.getChannel(name) end @@ -24,12 +30,18 @@ function love.thread.getChannel(name) end --- ---One use for them is to pass new unnamed channels to other threads via Channel:push on a named channel. --- +--- +---[Open in Browser](https://love2d.org/wiki/love.thread.newChannel) +--- ---@return love.Channel channel # The new Channel object. function love.thread.newChannel() end --- ---Creates a new Thread from a filename, string or FileData object containing Lua code. --- +--- +---[Open in Browser](https://love2d.org/wiki/love.thread.newThread) +--- ---@overload fun(fileData: love.FileData):love.Thread ---@overload fun(codestring: string):love.Thread ---@param filename string # The name of the Lua file to use as the source. @@ -39,12 +51,18 @@ function love.thread.newThread(filename) end --- ---An object which can be used to send and receive data between different threads. --- +--- +---[Open in Browser](https://love2d.org/wiki/love.thread) +--- ---@class love.Channel: love.Object local Channel = {} --- ---Clears all the messages in the Channel queue. --- +--- +---[Open in Browser](https://love2d.org/wiki/Channel:clear) +--- function Channel:clear() end --- @@ -52,6 +70,9 @@ function Channel:clear() end --- ---It waits until a message is in the queue then returns the message value. --- +--- +---[Open in Browser](https://love2d.org/wiki/Channel:demand) +--- ---@overload fun(self: love.Channel, timeout: number):any ---@return any value # The contents of the message. function Channel:demand() end @@ -59,12 +80,18 @@ function Channel:demand() end --- ---Retrieves the number of messages in the thread Channel queue. --- +--- +---[Open in Browser](https://love2d.org/wiki/Channel:getCount) +--- ---@return number count # The number of messages in the queue. function Channel:getCount() end --- ---Gets whether a pushed value has been popped or otherwise removed from the Channel. --- +--- +---[Open in Browser](https://love2d.org/wiki/Channel:hasRead) +--- ---@param id number # An id value previously returned by Channel:push. ---@return boolean hasread # Whether the value represented by the id has been removed from the Channel via Channel:pop, Channel:demand, or Channel:clear. function Channel:hasRead(id) end @@ -74,6 +101,9 @@ function Channel:hasRead(id) end --- ---It returns nil if there's no message in the queue. --- +--- +---[Open in Browser](https://love2d.org/wiki/Channel:peek) +--- ---@return any value # The contents of the message. function Channel:peek() end @@ -84,6 +114,9 @@ function Channel:peek() end --- ---This method avoids that issue by making sure the Thread calling the method has exclusive access to the Channel until the specified function has returned. --- +--- +---[Open in Browser](https://love2d.org/wiki/Channel:performAtomic) +--- ---@param func function # The function to call, the form of function(channel, arg1, arg2, ...) end. The Channel is passed as the first argument to the function when it is called. ---@param arg1 any # Additional arguments that the given function will receive when it is called. ---@vararg any # Additional arguments that the given function will receive when it is called. @@ -95,6 +128,9 @@ function Channel:performAtomic(func, arg1, ...) end --- ---It returns nil if there are no messages in the queue. --- +--- +---[Open in Browser](https://love2d.org/wiki/Channel:pop) +--- ---@return any value # The contents of the message. function Channel:pop() end @@ -103,6 +139,9 @@ function Channel:pop() end --- ---See Variant for the list of supported types. --- +--- +---[Open in Browser](https://love2d.org/wiki/Channel:push) +--- ---@param value any # The contents of the message. ---@return number id # Identifier which can be supplied to Channel:hasRead function Channel:push(value) end @@ -112,6 +151,9 @@ function Channel:push(value) end --- ---See Variant for the list of supported types. --- +--- +---[Open in Browser](https://love2d.org/wiki/Channel:supply) +--- ---@overload fun(self: love.Channel, value: any, timeout: number):boolean ---@param value any # The contents of the message. ---@return boolean success # Whether the message was successfully supplied (always true). @@ -120,12 +162,18 @@ function Channel:supply(value) end --- ---A Thread is a chunk of code that can run in parallel with other threads. Data can be sent between different threads with Channel objects. --- +--- +---[Open in Browser](https://love2d.org/wiki/love.thread) +--- ---@class love.Thread: love.Object local Thread = {} --- ---Retrieves the error string from the thread if it produced an error. --- +--- +---[Open in Browser](https://love2d.org/wiki/Thread:getError) +--- ---@return string err # The error message, or nil if the Thread has not caused an error. function Thread:getError() end @@ -134,6 +182,9 @@ function Thread:getError() end --- ---Threads which are not running can be (re)started with Thread:start. --- +--- +---[Open in Browser](https://love2d.org/wiki/Thread:isRunning) +--- ---@return boolean value # True if the thread is running, false otherwise. function Thread:isRunning() end @@ -142,6 +193,9 @@ function Thread:isRunning() end --- ---Beginning with version 0.9.0, threads can be restarted after they have completed their execution. --- +--- +---[Open in Browser](https://love2d.org/wiki/Thread:start) +--- ---@overload fun(self: love.Thread, arg1: any, arg2: any, ...) function Thread:start() end @@ -150,4 +204,7 @@ function Thread:start() end --- ---This call will block until the thread finishes. --- +--- +---[Open in Browser](https://love2d.org/wiki/Thread:wait) +--- function Thread:wait() end |