From 4998078d2aa2d089058cf8ffd3efab729fb9a990 Mon Sep 17 00:00:00 2001 From: nagadomi Date: Fri, 21 Oct 2016 00:21:57 +0900 Subject: [PATCH] use threads.safe to avoid deadlock problem --- train.lua | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/train.lua b/train.lua index 22ac1c9..c0ea923 100644 --- a/train.lua +++ b/train.lua @@ -54,6 +54,7 @@ local function transform_pool_init(has_resize, offset) g_mutex_id = g_mutex:id() g_transform_pool = threads.Threads( nthread, + threads.safe( function(threadid) require 'pl' local __FILE__ = (function() return string.gsub(debug.getinfo(2, 'S').source, "^@", "") end)() @@ -184,7 +185,7 @@ local function transform_pool_init(has_resize, offset) n, conf) end end - end + end) ) g_transform_pool:synchronize() end