From 9ea37c6c9fdeb4e26452acae57208506d71f1a95 Mon Sep 17 00:00:00 2001 From: sletz Date: Wed, 9 Dec 2009 06:06:40 +0000 Subject: [PATCH 1/2] When threads are cancelled, the exception has to be rethrown. git-svn-id: http://subversion.jackaudio.org/jack/jack2/trunk/jackmp@3850 0c269be4-1314-0410-8aa9-9f06e86f4224 --- ChangeLog | 4 ++++ common/JackLockedEngine.h | 17 ++++++++++++++--- 2 files changed, 18 insertions(+), 3 deletions(-) diff --git a/ChangeLog b/ChangeLog index 4d94ad74..7f7ac9b5 100644 --- a/ChangeLog +++ b/ChangeLog @@ -27,6 +27,10 @@ Josh Green Jackdmp changes log --------------------------- +2009-12-09 Stephane Letz + + * When threads are cancelled, the exception has to be rethrown. + 2009-12-08 Stephane Letz * Josh Green ALSA driver capture only patch. diff --git a/common/JackLockedEngine.h b/common/JackLockedEngine.h index c2de8512..6d7b2201 100644 --- a/common/JackLockedEngine.h +++ b/common/JackLockedEngine.h @@ -31,6 +31,16 @@ namespace Jack #define TRY_CALL \ try { \ +/* +See : http://groups.google.com/group/comp.programming.threads/browse_thread/thread/652bcf186fbbf697/f63757846514e5e5 + +catch (...) { + // Assuming thread cancellation, must rethrow + throw; + +} +*/ + #define CATCH_EXCEPTION_RETURN \ } catch(std::bad_alloc& e) { \ jack_error("Memory allocation error..."); \ @@ -40,15 +50,16 @@ namespace Jack JackTools::KillServer(); \ return -1; \ } catch (...) { \ - jack_error("Unknown error..."); \ - return -1; \ + jack_error("Unknown error..."); \ + throw; \ } \ #define CATCH_ENGINE_EXCEPTION \ } catch(std::bad_alloc& e) { \ jack_error("Memory allocation error..."); \ } catch (...) { \ - jack_error("Unknown error..."); \ + jack_error("Unknown error..."); \ + throw; \ } \ /*! From c48af774057ed3262c9ad09a392beeb3c08d11fd Mon Sep 17 00:00:00 2001 From: sletz Date: Wed, 9 Dec 2009 06:28:21 +0000 Subject: [PATCH 2/2] Correct rename callback in tests. git-svn-id: http://subversion.jackaudio.org/jack/jack2/trunk/jackmp@3851 0c269be4-1314-0410-8aa9-9f06e86f4224 --- common/JackLockedEngine.h | 4 ++-- tests/test.cpp | 1 + 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/common/JackLockedEngine.h b/common/JackLockedEngine.h index 6d7b2201..1b22d607 100644 --- a/common/JackLockedEngine.h +++ b/common/JackLockedEngine.h @@ -50,7 +50,7 @@ catch (...) { JackTools::KillServer(); \ return -1; \ } catch (...) { \ - jack_error("Unknown error..."); \ + jack_error("Unknown error..."); \ throw; \ } \ @@ -58,7 +58,7 @@ catch (...) { } catch(std::bad_alloc& e) { \ jack_error("Memory allocation error..."); \ } catch (...) { \ - jack_error("Unknown error..."); \ + jack_error("Unknown error..."); \ throw; \ } \ diff --git a/tests/test.cpp b/tests/test.cpp index 1c558bc2..018b7499 100644 --- a/tests/test.cpp +++ b/tests/test.cpp @@ -185,6 +185,7 @@ int Jack_Port_Rename_Callback(jack_port_id_t port, const char* old_name, const c { Log("Rename callback has been successfully called with old_name '%s' and new_name '%s'. (msg from callback)\n"); port_rename_clbk = 1; + return 0; } int Jack_Update_Buffer_Size(jack_nframes_t nframes, void *arg)