Welcome to mirror list, hosted at ThFree Co, Russian Federation.

test-threads-error.lua « test - github.com/torch/threads-ffi.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 01bf4dd4797c4aad1081a739360aed797618b9b4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
local threads = require 'threads'

local t = threads.Threads(1, function()
    sys = require 'sys'
end)

-- Trigger an error in an endcallback. The callback is run during lua_close
-- when the Threads:synchronize method is called from the __gc metamethod.
-- The error may prevent the thread from terminating before the threads module
-- and libthreads.so is unloaded. In previous versions of threads this would
-- cause a segfault.

t:addjob(function()
	sys.sleep(0.1)
end, function()
    error('error from callback')
end)