util/async.lua
changeset 5793 e8c79796ead9
parent 5792 aac4c6147647
child 5794 66c3ad5d29ad
equal deleted inserted replaced
5792:aac4c6147647 5793:e8c79796ead9
    35 		coroutine.yield("wait");
    35 		coroutine.yield("wait");
    36 	end, function ()
    36 	end, function ()
    37 		num = num - 1;
    37 		num = num - 1;
    38 		if num == 0 and waiting then
    38 		if num == 0 and waiting then
    39 			runner_continue(thread);
    39 			runner_continue(thread);
       
    40 		elseif num < 0 then
       
    41 			error("done() called too many times");
    40 		end
    42 		end
    41 	end;
    43 	end;
    42 end
    44 end
    43 
    45 
    44 local runner_mt = {};
    46 local runner_mt = {};