To dispose ManualResetEvent handle after it is used, using is used.
/// <since_tizen> 3 </since_tizen>
public override void Send(SendOrPostCallback d, object state)
{
- var mre = new ManualResetEvent(false);
- Exception err = null;
- GSourceManager.Post(() =>
+ using (var mre = new ManualResetEvent(false))
{
- try
- {
- d(state);
- }
- catch (Exception ex)
+ Exception err = null;
+ GSourceManager.Post(() =>
{
- err = ex;
- }
- finally
+ try
+ {
+ d(state);
+ }
+ catch (Exception ex)
+ {
+ err = ex;
+ }
+ finally
+ {
+ mre.Set();
+ }
+ });
+ mre.WaitOne();
+ if (err != null)
{
- mre.Set();
+ throw err;
}
- });
- mre.WaitOne();
- if (err != null)
- {
- throw err;
}
}
}
/// <since_tizen> 10 </since_tizen>
public override void Send(SendOrPostCallback d, object state)
{
- var mre = new ManualResetEvent(false);
- Exception err = null;
- GSourceManager.Post(() =>
+ using (var mre = new ManualResetEvent(false))
{
- try
- {
- d(state);
- }
- catch (Exception ex)
+ Exception err = null;
+ GSourceManager.Post(() =>
{
- err = ex;
- }
- finally
+ try
+ {
+ d(state);
+ }
+ catch (Exception ex)
+ {
+ err = ex;
+ }
+ finally
+ {
+ mre.Set();
+ }
+ }, true);
+ mre.WaitOne();
+ if (err != null)
{
- mre.Set();
+ throw err;
}
- }, true);
- mre.WaitOne();
- if (err != null)
- {
- throw err;
}
}
}