From b79e6bea522bcf7b8f5722970e6fe450e866984c Mon Sep 17 00:00:00 2001 From: Kenneth Lundin Date: Fri, 26 Nov 2010 08:35:41 +0100 Subject: 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. --- lib/asn1/src/asn1rt_driver_handler.erl | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'lib') 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 -> -- cgit v1.2.3