Quantcast
Channel: sshnet Issue Tracker Rss Feed
Viewing all articles
Browse latest Browse all 1026

Commented Issue: Thread-safe event handling [1551]

$
0
0
Consider rewriting this:

if (this.ErrorOccurred != null)
{
this.ErrorOccurred(this, e);
}

Into:

var handler = ErrorOccurred;
if (handler != null)
{
handler(this, e);
}
Comments: ** Comment from web user: olegkap **

Hi,

Thanks for this recommendation, didn't think of that.
But now I have a questions, should I lock var handler = ErrorOccurred; ?
Since potentially it could change during assignment operation.

Thanks,
Oleg


Viewing all articles
Browse latest Browse all 1026

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>