Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Channel:demand() Would freeze entire window when using release version #99

Open
ParticleG opened this issue Nov 1, 2024 · 1 comment

Comments

@ParticleG
Copy link

No description provided.

@MrZ626
Copy link

MrZ626 commented Nov 1, 2024

--------main.lua

-- Wait data with ":getCount()>0"
love.thread.newThread[[
    local channel=love.thread.getChannel("CHN_1")
    print("TH 1: Looping...")
    repeat until channel:getCount()>0
    print("TH 1: Received",channel:pop())
]]:start()

-- Wait data with ":demand()"
love.thread.newThread[[
    local channel=love.thread.getChannel("CHN_2")
    print("TH 2: Demanding...")
    local v=channel:demand()
    print("TH 2: Received",v)
]]:start()

-- Control group, :demand() will timeout after 5s
love.thread.newThread[[
    local channel=love.thread.getChannel("CHN_3")
    print("TH 3: Demanding...")
    local v=channel:demand(2.6)
    print("TH 3: Received",v)
]]:start()

love.timer.sleep(1)

love.thread.getChannel("CHN_1"):push("DATA 1")
love.thread.getChannel("CHN_2"):push("DATA 2")

function love.draw() love.graphics.print("Check console",0,0,0,6) end

image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants