diff options
author | Matthew Sackman <matthew@lshift.net> | 2010-04-30 16:14:42 +0100 |
---|---|---|
committer | Matthew Sackman <matthew@lshift.net> | 2010-04-30 16:14:42 +0100 |
commit | c61ed92d071142e4502ee69798ce69d0b9b7fc7f (patch) | |
tree | 42ea99cb280957c6e08fc4351be4cd0603d05e58 /src/worker_pool_worker.erl | |
parent | 44e1299ea1de5889a41bc2631abdc9a2cc323682 (diff) | |
download | rabbitmq-server-c61ed92d071142e4502ee69798ce69d0b9b7fc7f.tar.gz |
Pulling good patches off bad head of default
Diffstat (limited to 'src/worker_pool_worker.erl')
-rw-r--r-- | src/worker_pool_worker.erl | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/src/worker_pool_worker.erl b/src/worker_pool_worker.erl index d3a48119..9ef8c636 100644 --- a/src/worker_pool_worker.erl +++ b/src/worker_pool_worker.erl @@ -46,6 +46,8 @@ -spec(submit/2 :: (pid(), fun (() -> A) | {atom(), atom(), [any()]}) -> A). -spec(submit_async/2 :: (pid(), fun (() -> any()) | {atom(), atom(), [any()]}) -> 'ok'). +-spec(run/1 :: (fun (() -> A)) -> A; + ({atom(), atom(), [any()]}) -> any()). -endif. @@ -65,6 +67,13 @@ submit(Pid, Fun) -> submit_async(Pid, Fun) -> gen_server2:cast(Pid, {submit_async, Fun}). +run({M, F, A}) -> + apply(M, F, A); +run(Fun) -> + Fun(). + +%%---------------------------------------------------------------------------- + init([WId]) -> ok = worker_pool:idle(WId), put(worker_pool_worker, true), @@ -95,10 +104,3 @@ code_change(_OldVsn, State, _Extra) -> terminate(_Reason, State) -> State. - -%%---------------------------------------------------------------------------- - -run({M, F, A}) -> - apply(M, F, A); -run(Fun) -> - Fun(). |