summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/worker_pool.erl12
1 files changed, 4 insertions, 8 deletions
diff --git a/src/worker_pool.erl b/src/worker_pool.erl
index bdcafc8419..af5e289688 100644
--- a/src/worker_pool.erl
+++ b/src/worker_pool.erl
@@ -61,14 +61,10 @@ start_link() ->
submit(Fun) ->
%% If the worker_pool is not running, just run the Fun in the
%% current process.
- case whereis(?SERVER) of
- undefined -> Fun();
- _ -> case get(worker_pool_worker) of
- true -> worker_pool_worker:run(Fun);
- _ -> Pid = gen_server2:call(?SERVER, next_free,
- infinity),
- worker_pool_worker:submit(Pid, Fun)
- end
+ case get(worker_pool_worker) =:= true orelse whereis(?SERVER) =:= undefined of
+ true -> worker_pool_worker:run(Fun);
+ false -> Pid = gen_server2:call(?SERVER, next_free, infinity),
+ worker_pool_worker:submit(Pid, Fun)
end.
submit_async(Fun) ->