diff options
author | Alexander Schmolck <alexander@lshift.net> | 2010-01-13 15:15:39 +0000 |
---|---|---|
committer | Alexander Schmolck <alexander@lshift.net> | 2010-01-13 15:15:39 +0000 |
commit | 3da3fe70f3ca2fcb8debbc23a7a92447b83f555b (patch) | |
tree | 5bf2c4e6fd186856fd1c9e889c3d8b80184b4154 | |
parent | 269f48235dcb3dc915411fea06bc65c787769832 (diff) | |
download | rabbitmq-server-3da3fe70f3ca2fcb8debbc23a7a92447b83f555b.tar.gz |
bug22209: added a comment to use upmap carefully.
-rw-r--r-- | src/rabbit_misc.erl | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/src/rabbit_misc.erl b/src/rabbit_misc.erl index 21764fce..d927bfb1 100644 --- a/src/rabbit_misc.erl +++ b/src/rabbit_misc.erl @@ -97,7 +97,7 @@ -spec(enable_cover/1 :: (string()) -> ok_or_error()). -spec(report_cover/1 :: (string()) -> 'ok'). -spec(throw_on_error/2 :: - (atom(), thunk({error, any()} | {ok, A} | A)) -> A). + (atom(), thunk({error, any()} | {ok, A} | A)) -> A). -spec(with_exit_handler/2 :: (thunk(A), thunk(A)) -> A). -spec(filter_exit_map/2 :: (fun ((A) -> B), [A]) -> [B]). -spec(with_user/2 :: (username(), thunk(A)) -> A). @@ -339,6 +339,9 @@ intersperse(Sep, [E|T]) -> [E, Sep | intersperse(Sep, T)]. %% This is a modified version of Luke Gorrie's pmap - %% http://lukego.livejournal.com/6753.html - that doesn't care about %% the order in which results are received. +%% +%% WARNING: This is is deliberately lightweight rather than robust -- if F +%% throws, upmap will hang forever, so make sure F doesn't throw! upmap(F, L) -> Parent = self(), Ref = make_ref(), @@ -427,7 +430,7 @@ append_file(File, _, Suffix) -> ensure_parent_dirs_exist(Filename) -> case filelib:ensure_dir(Filename) of ok -> ok; - {error, Reason} -> + {error, Reason} -> throw({error, {cannot_create_parent_dirs, Filename, Reason}}) end. |