Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
home:Ledest:erlang:19
gproc
gproc-0.9.1-git.patch
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File gproc-0.9.1-git.patch of Package gproc
diff --git a/src/gproc_lib.erl b/src/gproc_lib.erl old mode 100755 new mode 100644 diff --git a/src/gproc_pool.erl b/src/gproc_pool.erl index 709f323..be37c8d 100644 --- a/src/gproc_pool.erl +++ b/src/gproc_pool.erl @@ -439,8 +439,7 @@ claim(Pool, F, Wait) -> case gproc:get_value(?POOL(Pool), shared) of {0, _} -> false; {_, claim} -> - W = setup_wait(Wait, Pool), - claim_w(Pool, F, W); + claim_w(Pool, F, setup_wait(Wait)); _ -> error(badarg) end. @@ -452,7 +451,6 @@ claim_w(Pool, F, W) -> false -> claim_w(Pool, F, do_wait(W)); Other -> - clear_wait(W), Other end. @@ -554,35 +552,23 @@ execute_claim(F, K, Pid) -> ?MAY_FAIL(gproc:reset_counter(K)) end. -setup_wait(nowait, _) -> +setup_wait(nowait) -> nowait; -setup_wait({busy_wait, MS}, Pool) -> - Ref = erlang:start_timer(MS, self(), {claim, Pool}), - {busy_wait, Ref}. +setup_wait({busy_wait, MS}) -> + {busy_wait, erlang:monotonic_time(millisecond) + MS}. do_wait(nowait) -> timeout; -do_wait({busy_wait, Ref} = W) -> +do_wait({busy_wait, EndTime} = W) -> %% Yielding here serves two purposes: %% 1) Increase the chance that whoever's before us can finish %% 2) The value of read_timer/1 only refreshes after yield (so I've heard) erlang:yield(), - case erlang:read_timer(Ref) of - false -> - receive {timeout, Ref, _} -> ok - after 0 -> ok - end, - timeout; - _ -> - W + case erlang:monotonic_time(millisecond) >= EndTime of + true -> timeout; + false -> W end. -clear_wait(nowait) -> - ok; -clear_wait({busy_wait, Ref}) -> - erlang:cancel_timer(Ref), - ok. - %% @spec log(GprocKey) -> integer() %% @doc Update a counter associated with a worker name. %%
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor