webmcp

view framework/env/execute/_initializers.lua @ 412:7d43be9afa56

Improved memory cleanup in case of out-of-memory errors (PQnotifies and PQunescapeBytea)
author jbe
date Fri Jan 08 03:10:33 2016 +0100 (2016-01-08)
parents a2c733535b8e
children beb1e7925a52
line source
1 function execute._initializers(initializer_path_element)
2 local yieldvalue1 = {}
3 local yieldvalue2 = {}
4 local coro = coroutine.wrap(function()
5 execute.multi_wrapped(
6 execute._create_sorted_execution_list(
7 function(add_by_path)
8 add_by_path(initializer_path_element)
9 add_by_path(WEBMCP_APP_NAME, initializer_path_element)
10 end,
11 function(full_path, relative_path)
12 execute.file_path{ file_path = full_path }
13 end
14 ),
15 function()
16 coroutine.yield(yieldvalue1)
17 end
18 )
19 return yieldvalue2
20 end)
21 local yieldvalue = coro()
22 if yieldvalue == yieldvalue2 then
23 error("Initializers failed to call execute.inner()")
24 elseif yieldvalue ~= yieldvalue1 then
25 error("Unexpected yield in initializers")
26 end
27 execute._finalizers[#execute._finalizers+1] = function()
28 assert(coro() == yieldvalue2, "Unexpected yield in finalizers")
29 end
30 end

Impressum / About Us