]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
Detach mono threads
authorMichael Giagnocavo <mgg@giagnocavo.net>
Thu, 13 Aug 2009 00:34:30 +0000 (00:34 +0000)
committerMichael Giagnocavo <mgg@giagnocavo.net>
Thu, 13 Aug 2009 00:34:30 +0000 (00:34 +0000)
git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@14502 d0543943-73ff-0310-b7d9-9358b9ac24b2

src/mod/languages/mod_managed/mod_managed.cpp

index 0fab00fe6498f66628674618a5d3b3515c400d76..2fa5d11a41d9f799f7fdc5aff3e398806e575373 100644 (file)
@@ -375,11 +375,17 @@ SWITCH_STANDARD_API(managedrun_api_function)
                stream->write_function(stream, "-ERR no args specified!\n");    \r
                return SWITCH_STATUS_SUCCESS;\r
        }\r
+#ifndef _MANAGED\r
+       mono_thread_attach(globals.domain);\r
+#endif\r
        if (executeBackgroundDelegate(cmd)) {\r
                stream->write_function(stream, "+OK\n");\r
        } else {        \r
                stream->write_function(stream, "-ERR ExecuteBackground returned false (unknown module or exception?).\n");\r
        }\r
+#ifndef _MANAGED\r
+       mono_thread_detach(mono_thread_current());\r
+#endif\r
        return SWITCH_STATUS_SUCCESS;\r
 }\r
 \r
@@ -389,9 +395,15 @@ SWITCH_STANDARD_API(managed_api_function)
                stream->write_function(stream, "-ERR no args specified!\n");    \r
                return SWITCH_STATUS_SUCCESS;\r
        }\r
+#ifndef _MANAGED\r
+       mono_thread_attach(globals.domain);\r
+#endif\r
        if (!(executeDelegate(cmd, stream, stream->param_event))) {\r
                switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Execute failed for %s (unknown module or exception).\n", cmd); \r
        }\r
+#ifndef _MANAGED\r
+       mono_thread_detach(mono_thread_current());\r
+#endif\r
        return SWITCH_STATUS_SUCCESS;\r
 }\r
 \r
@@ -401,9 +413,15 @@ SWITCH_STANDARD_APP(managed_app_function)
                switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "No args specified!\n");\r
                return;\r
        }\r
+#ifndef _MANAGED\r
+       mono_thread_attach(globals.domain);\r
+#endif\r
        if (!(runDelegate(data, session))) {\r
                switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Application run failed for %s (unknown module or exception).\n", data);\r
        }\r
+#ifndef _MANAGED\r
+       mono_thread_detach(mono_thread_current());\r
+#endif\r
 }\r
 \r
 SWITCH_STANDARD_API(managedreload_api_function) \r
@@ -412,9 +430,15 @@ SWITCH_STANDARD_API(managedreload_api_function)
                stream->write_function(stream, "-ERR no args specified!\n");    \r
                return SWITCH_STATUS_SUCCESS;\r
        }\r
+#ifndef _MANAGED\r
+       mono_thread_attach(globals.domain);\r
+#endif\r
        if (!(reloadDelegate(cmd))) {\r
                switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Execute failed for %s (unknown module or exception).\n", cmd); \r
        }\r
+#ifndef _MANAGED\r
+       mono_thread_detach(mono_thread_current());\r
+#endif\r
        return SWITCH_STATUS_SUCCESS;\r
 }\r
 \r