Skip to content

Commit a17b70e

Browse files
authored
Add synchronized and exceptionally stubs
1 parent d91d917 commit a17b70e

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

library/lualink/globals.lua

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,3 +8,18 @@ server = {}
88

99
---@type Scheduler
1010
scheduler = {}
11+
12+
13+
--- Ensures that only one thread at a time can access a method or block of code, keeping shared data safe in multithreaded programs.
14+
--- @param lock java.lang.Object
15+
--- @param func function
16+
function synchronized(lock, func) end
17+
18+
--- Ensures that only one thread at a time can access a method or block of code, keeping shared data safe in multithreaded programs. This will use the main Lua state as the lock
19+
--- @param func function
20+
function synchronized(func) end
21+
22+
--- Let's you try-catch Java exceptions thrown when called from Lua
23+
--- @param try function
24+
--- @param catch fun(throwable: java.lang.Object
25+
function exceptionally(try: function, catch: function)

0 commit comments

Comments
 (0)