jbe@214: function execute._initializers(initializer_path_element) jbe@425: local yieldvalue_inner = {} jbe@425: local coro = coroutine.create(function() jbe@214: execute.multi_wrapped( jbe@214: execute._create_sorted_execution_list( jbe@214: function(add_by_path) jbe@214: add_by_path(initializer_path_element) jbe@316: add_by_path(WEBMCP_APP_NAME, initializer_path_element) jbe@214: end, jbe@214: function(full_path, relative_path) jbe@214: execute.file_path{ file_path = full_path } jbe@214: end jbe@214: ), jbe@214: function() jbe@425: coroutine.yield(yieldvalue_inner) jbe@214: end jbe@214: ) jbe@214: end) jbe@449: local success, value = coroutine.resume(coro) jbe@425: if not success then jbe@449: error(debug.traceback(coro, "Error in initializer: " .. tostring(value))) jbe@425: end jbe@425: if coroutine.status(coro) == "dead" then jbe@277: error("Initializers failed to call execute.inner()") jbe@449: elseif value ~= yieldvalue_inner then jbe@425: error("Unexpected yield in initializer") jbe@214: end jbe@277: execute._finalizers[#execute._finalizers+1] = function() jbe@449: local success, value = coroutine.resume(coro) jbe@449: if not success then jbe@449: error(debug.traceback(coro, "Error in finalizer: " .. tostring(value))) jbe@425: end jbe@425: if coroutine.status(coro) ~= "dead" then jbe@425: error("Unexpected yield in finalizer") jbe@425: end jbe@277: end jbe@214: end