aboutsummaryrefslogtreecommitdiffstats
path: root/lib/common_test/src/ct_util.erl
diff options
context:
space:
mode:
authorPeter Andersson <[email protected]>2012-03-08 14:03:46 +0100
committerPeter Andersson <[email protected]>2012-03-08 14:03:46 +0100
commit91f60211efb41d935269edfad7a9c0312b8011d0 (patch)
tree8e22025504af65f685b47bd63719d1f617eac4ab /lib/common_test/src/ct_util.erl
parenta7714f269498e51f02c598446ef8626c380d30b1 (diff)
downloadotp-91f60211efb41d935269edfad7a9c0312b8011d0.tar.gz
otp-91f60211efb41d935269edfad7a9c0312b8011d0.tar.bz2
otp-91f60211efb41d935269edfad7a9c0312b8011d0.zip
Fix problem with buffered DOWN messages
OTP-9830
Diffstat (limited to 'lib/common_test/src/ct_util.erl')
-rw-r--r--lib/common_test/src/ct_util.erl23
1 files changed, 14 insertions, 9 deletions
diff --git a/lib/common_test/src/ct_util.erl b/lib/common_test/src/ct_util.erl
index 3b6ad6f98d..e9bfb2590b 100644
--- a/lib/common_test/src/ct_util.erl
+++ b/lib/common_test/src/ct_util.erl
@@ -827,15 +827,20 @@ get_profile_data(Profile, Key, StartDir) ->
%%%-----------------------------------------------------------------
%%% Internal functions
call(Msg) ->
- MRef = erlang:monitor(process,whereis(ct_util_server)),
- Ref = make_ref(),
- ct_util_server ! {Msg,{self(),Ref}},
- receive
- {Ref, Result} ->
- erlang:demonitor(MRef, [flush]),
- Result;
- {'DOWN',MRef,process,_,Reason} ->
- {error,{ct_util_server_down,Reason}}
+ case whereis(ct_util_server) of
+ undefined ->
+ {error,ct_util_server_not_running};
+ Pid ->
+ MRef = erlang:monitor(process, Pid),
+ Ref = make_ref(),
+ ct_util_server ! {Msg,{self(),Ref}},
+ receive
+ {Ref, Result} ->
+ erlang:demonitor(MRef, [flush]),
+ Result;
+ {'DOWN',MRef,process,_,Reason} ->
+ {error,{ct_util_server_down,Reason}}
+ end
end.
return({To,Ref},Result) ->