From f99ee375a998db1afd0c376c6f7e446bda033dc3 Mon Sep 17 00:00:00 2001 From: Michael Giagnocavo Date: Thu, 13 Aug 2009 00:34:30 +0000 Subject: [PATCH] Detach mono threads git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@14502 d0543943-73ff-0310-b7d9-9358b9ac24b2 --- src/mod/languages/mod_managed/mod_managed.cpp | 24 +++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/src/mod/languages/mod_managed/mod_managed.cpp b/src/mod/languages/mod_managed/mod_managed.cpp index 0fab00fe64..2fa5d11a41 100644 --- a/src/mod/languages/mod_managed/mod_managed.cpp +++ b/src/mod/languages/mod_managed/mod_managed.cpp @@ -375,11 +375,17 @@ SWITCH_STANDARD_API(managedrun_api_function) stream->write_function(stream, "-ERR no args specified!\n"); return SWITCH_STATUS_SUCCESS; } +#ifndef _MANAGED + mono_thread_attach(globals.domain); +#endif if (executeBackgroundDelegate(cmd)) { stream->write_function(stream, "+OK\n"); } else { stream->write_function(stream, "-ERR ExecuteBackground returned false (unknown module or exception?).\n"); } +#ifndef _MANAGED + mono_thread_detach(mono_thread_current()); +#endif return SWITCH_STATUS_SUCCESS; } @@ -389,9 +395,15 @@ SWITCH_STANDARD_API(managed_api_function) stream->write_function(stream, "-ERR no args specified!\n"); return SWITCH_STATUS_SUCCESS; } +#ifndef _MANAGED + mono_thread_attach(globals.domain); +#endif if (!(executeDelegate(cmd, stream, stream->param_event))) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Execute failed for %s (unknown module or exception).\n", cmd); } +#ifndef _MANAGED + mono_thread_detach(mono_thread_current()); +#endif return SWITCH_STATUS_SUCCESS; } @@ -401,9 +413,15 @@ SWITCH_STANDARD_APP(managed_app_function) switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "No args specified!\n"); return; } +#ifndef _MANAGED + mono_thread_attach(globals.domain); +#endif if (!(runDelegate(data, session))) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Application run failed for %s (unknown module or exception).\n", data); } +#ifndef _MANAGED + mono_thread_detach(mono_thread_current()); +#endif } SWITCH_STANDARD_API(managedreload_api_function) @@ -412,9 +430,15 @@ SWITCH_STANDARD_API(managedreload_api_function) stream->write_function(stream, "-ERR no args specified!\n"); return SWITCH_STATUS_SUCCESS; } +#ifndef _MANAGED + mono_thread_attach(globals.domain); +#endif if (!(reloadDelegate(cmd))) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Execute failed for %s (unknown module or exception).\n", cmd); } +#ifndef _MANAGED + mono_thread_detach(mono_thread_current()); +#endif return SWITCH_STATUS_SUCCESS; }