summaryrefslogtreecommitdiff
path: root/src/bin
diff options
context:
space:
mode:
authorLauro Moura <lauromoura@expertisesolutions.com.br>2019-10-03 20:52:25 -0300
committerLauro Moura <lauromoura@expertisesolutions.com.br>2019-10-04 10:12:57 -0300
commitd5c8d0529278300eb889881b4774deebc4d46f31 (patch)
treef5af4c8c4fb6851ad8b1efecae7597c0c5297a9f /src/bin
parent6d8e39a6425e721eb40e0cb1e67f1cbf5b223cc0 (diff)
csharp: Move locks inside AddRemove native handlers
Summary: Instead of using a lock block in every method definition, we just need them inside the actual methods adding/removing the handlers. Kudos to @herb for the suggestion. Reviewers: felipealmeida, herb, brunobelo Reviewed By: brunobelo Subscribers: cedric, #reviewers, herb, #committers Tags: #efl Differential Revision: https://phab.enlightenment.org/D9758
Diffstat (limited to 'src/bin')
-rw-r--r--src/bin/eolian_mono/eolian/mono/events.hh40
1 files changed, 17 insertions, 23 deletions
diff --git a/src/bin/eolian_mono/eolian/mono/events.hh b/src/bin/eolian_mono/eolian/mono/events.hh
index 6c5f12e..2e4ca32 100644
--- a/src/bin/eolian_mono/eolian/mono/events.hh
+++ b/src/bin/eolian_mono/eolian/mono/events.hh
@@ -447,36 +447,30 @@ struct event_definition_generator
447 scope_tab << "{\n" 447 scope_tab << "{\n"
448 << scope_tab << scope_tab << "add\n" 448 << scope_tab << scope_tab << "add\n"
449 << scope_tab << scope_tab << "{\n" 449 << scope_tab << scope_tab << "{\n"
450 << scope_tab << scope_tab << scope_tab << "lock (eflBindingEventLock)\n" 450 << scope_tab << scope_tab << scope_tab << "Efl.EventCb callerCb = (IntPtr data, ref Efl.Event.NativeStruct evt) =>\n"
451 << scope_tab << scope_tab << scope_tab << "{\n" 451 << scope_tab << scope_tab << scope_tab << "{\n"
452 << scope_tab << scope_tab << scope_tab << scope_tab << "Efl.EventCb callerCb = (IntPtr data, ref Efl.Event.NativeStruct evt) =>\n" 452 << scope_tab << scope_tab << scope_tab << scope_tab << "var obj = Efl.Eo.Globals.WrapperSupervisorPtrToManaged(data).Target;\n"
453 << scope_tab << scope_tab << scope_tab << scope_tab << "if (obj != null)\n"
453 << scope_tab << scope_tab << scope_tab << scope_tab << "{\n" 454 << scope_tab << scope_tab << scope_tab << scope_tab << "{\n"
454 << scope_tab << scope_tab << scope_tab << scope_tab << scope_tab << "var obj = Efl.Eo.Globals.WrapperSupervisorPtrToManaged(data).Target;\n" 455 << scope_tab << scope_tab << scope_tab << scope_tab << scope_tab << event_args
455 << scope_tab << scope_tab << scope_tab << scope_tab << scope_tab << "if (obj != null)\n" 456 << scope_tab << scope_tab << scope_tab << scope_tab << scope_tab << "try\n"
456 << scope_tab << scope_tab << scope_tab << scope_tab << scope_tab << "{\n" 457 << scope_tab << scope_tab << scope_tab << scope_tab << scope_tab << "{\n"
457 << scope_tab << scope_tab << scope_tab << scope_tab << scope_tab << scope_tab << event_args 458 << scope_tab << scope_tab << scope_tab << scope_tab << scope_tab << scope_tab << "value?.Invoke(obj, args);\n"
458 << scope_tab << scope_tab << scope_tab << scope_tab << scope_tab << scope_tab << "try\n"
459 << scope_tab << scope_tab << scope_tab << scope_tab << scope_tab << scope_tab << "{\n"
460 << scope_tab << scope_tab << scope_tab << scope_tab << scope_tab << scope_tab << scope_tab << "value?.Invoke(obj, args);\n"
461 << scope_tab << scope_tab << scope_tab << scope_tab << scope_tab << scope_tab << "}\n"
462 << scope_tab << scope_tab << scope_tab << scope_tab << scope_tab << scope_tab << "catch (Exception e)\n"
463 << scope_tab << scope_tab << scope_tab << scope_tab << scope_tab << scope_tab << "{\n"
464 << scope_tab << scope_tab << scope_tab << scope_tab << scope_tab << scope_tab << scope_tab << "Eina.Log.Error(e.ToString());\n"
465 << scope_tab << scope_tab << scope_tab << scope_tab << scope_tab << scope_tab << scope_tab << "Eina.Error.Set(Eina.Error.UNHANDLED_EXCEPTION);\n"
466 << scope_tab << scope_tab << scope_tab << scope_tab << scope_tab << scope_tab << "}\n"
467 << scope_tab << scope_tab << scope_tab << scope_tab << scope_tab << "}\n" 459 << scope_tab << scope_tab << scope_tab << scope_tab << scope_tab << "}\n"
468 << scope_tab << scope_tab << scope_tab << scope_tab << "};\n\n" 460 << scope_tab << scope_tab << scope_tab << scope_tab << scope_tab << "catch (Exception e)\n"
469 << scope_tab << scope_tab << scope_tab << scope_tab << "string key = \"_" << upper_c_name << "\";\n" 461 << scope_tab << scope_tab << scope_tab << scope_tab << scope_tab << "{\n"
470 << scope_tab << scope_tab << scope_tab << scope_tab << "AddNativeEventHandler(" << library_name << ", key, callerCb, value);\n" 462 << scope_tab << scope_tab << scope_tab << scope_tab << scope_tab << scope_tab << "Eina.Log.Error(e.ToString());\n"
471 << scope_tab << scope_tab << scope_tab << "}\n" // End of lock block 463 << scope_tab << scope_tab << scope_tab << scope_tab << scope_tab << scope_tab << "Eina.Error.Set(Eina.Error.UNHANDLED_EXCEPTION);\n"
464 << scope_tab << scope_tab << scope_tab << scope_tab << scope_tab << "}\n"
465 << scope_tab << scope_tab << scope_tab << scope_tab << "}\n"
466 << scope_tab << scope_tab << scope_tab << "};\n\n"
467 << scope_tab << scope_tab << scope_tab << "string key = \"_" << upper_c_name << "\";\n"
468 << scope_tab << scope_tab << scope_tab << "AddNativeEventHandler(" << library_name << ", key, callerCb, value);\n"
472 << scope_tab << scope_tab << "}\n\n" 469 << scope_tab << scope_tab << "}\n\n"
473 << scope_tab << scope_tab << "remove\n" 470 << scope_tab << scope_tab << "remove\n"
474 << scope_tab << scope_tab << "{\n" 471 << scope_tab << scope_tab << "{\n"
475 << scope_tab << scope_tab << scope_tab << "lock (eflBindingEventLock)\n" 472 << scope_tab << scope_tab << scope_tab << "string key = \"_" << upper_c_name << "\";\n"
476 << scope_tab << scope_tab << scope_tab << "{\n" 473 << scope_tab << scope_tab << scope_tab << "RemoveNativeEventHandler(" << library_name << ", key, value);\n"
477 << scope_tab << scope_tab << scope_tab << scope_tab << "string key = \"_" << upper_c_name << "\";\n"
478 << scope_tab << scope_tab << scope_tab << scope_tab << "RemoveNativeEventHandler(" << library_name << ", key, value);\n"
479 << scope_tab << scope_tab << scope_tab << "}\n" // End of lock block
480 << scope_tab << scope_tab << "}\n" 474 << scope_tab << scope_tab << "}\n"
481 << scope_tab << "}\n\n" 475 << scope_tab << "}\n\n"
482 ).generate(sink, attributes::unused, context); 476 ).generate(sink, attributes::unused, context);