Sign In| Join
Get Help:Ask a Question in our Forums|Report a Bug|More Help Resources
Last post Dec 20, 2003 06:35 PM by taylorza
Member
80 Points
16 Posts
Dec 20, 2003 03:12 PM|LINK
ArrayList al = new ArrayList(); // other code here... try { lock(al) { // Do something... throw new Exception("UH OH!"); } } catch(Exception ex) { // Is al still locked??? }
325 Points
65 Posts
Dec 20, 2003 06:30 PM|LINK
try { Monitor.Enter( al ); // Do something... throw new ApplicationException( "UH OH!"); } finally { Monitor.Leave( al ); }
try { try { Monitor.Enter( al ); // Do something... throw new ApplicationException( "UH OH!"); } finally { Monitor.Leave( al ); } } catch ( Exception ex ) { }
grennis
Member
80 Points
16 Posts
Throwing exceptions inside lock() blocks
Dec 20, 2003 03:12 PM|LINK
ArrayList al = new ArrayList(); // other code here... try { lock(al) { // Do something... throw new Exception("UH OH!"); } } catch(Exception ex) { // Is al still locked??? }taylorza
Member
325 Points
65 Posts
Re: Throwing exceptions inside lock() blocks
Dec 20, 2003 06:30 PM|LINK
try { Monitor.Enter( al ); // Do something... throw new ApplicationException( "UH OH!"); } finally { Monitor.Leave( al ); }So the code above results intry { try { Monitor.Enter( al ); // Do something... throw new ApplicationException( "UH OH!"); } finally { Monitor.Leave( al ); } } catch ( Exception ex ) { }Hope this helpsMy Blog