我想在兩個車道之間共享一個全局變量,想法是當lane1更新一個共享變量時,我應該能夠在車道2得到預定時獲得它的更新值。有針對這個的解決方法嗎? 代碼片段如下: - shared_variable = 0
local function lane1()
..
shared_variable = shared_variable + 1
end
local function l
我試圖用Lua的2條車道間的鎖,但觀察到,無論是車道進入lock_func simultaneously..Below是片段 Code Snippet
==================
require"lanes"
local linda = lanes.linda()
lock_func = lanes.genlock(linda,"M",1)
local function
local lanes = require "lanes".configure()
local linda = lanes.linda()
local thread = lanes.gen({globals = _G}, function()
print("Starting thread...")
while true do
local command = linda:recei