aboutsummaryrefslogtreecommitdiffstats
path: root/lib/asn1
diff options
context:
space:
mode:
authorKenneth Lundin <[email protected]>2010-11-26 08:35:41 +0100
committerKenneth Lundin <[email protected]>2010-11-26 08:35:41 +0100
commitb79e6bea522bcf7b8f5722970e6fe450e866984c (patch)
tree5f78f557fd5bf79c782be93abd32042e587819d7 /lib/asn1
parent99a28d961d2d760e98353b55991f1fc51dee06b0 (diff)
downloadotp-b79e6bea522bcf7b8f5722970e6fe450e866984c.tar.gz
otp-b79e6bea522bcf7b8f5722970e6fe450e866984c.tar.bz2
otp-b79e6bea522bcf7b8f5722970e6fe450e866984c.zip
Correct a race-condition during loading of driver
The asn1 driver is loaded automatically when first needed. If several processes in parallel is doing asn1 encode or decode a race could appear which caused an ERROR report for a crashed process. The system still worked as intended, but an unnecessary ERROR report is no good.
Diffstat (limited to 'lib/asn1')
-rw-r--r--lib/asn1/src/asn1rt_driver_handler.erl5
1 files changed, 4 insertions, 1 deletions
diff --git a/lib/asn1/src/asn1rt_driver_handler.erl b/lib/asn1/src/asn1rt_driver_handler.erl
index c95b243ae0..cc2b501e16 100644
--- a/lib/asn1/src/asn1rt_driver_handler.erl
+++ b/lib/asn1/src/asn1rt_driver_handler.erl
@@ -71,7 +71,10 @@ load_driver(Reason) ->
end.
init(FromPid,FromRef) ->
- register(asn1_driver_owner,self()),
+ case catch register(asn1_driver_owner,self()) of
+ true -> true;
+ _Other -> exit(normal)
+ end,
Dir = filename:join([code:priv_dir(asn1),"lib"]),
case catch erl_ddll:load_driver(Dir,asn1_erl_drv) of
ok ->