diff --git a/c/src/exec/libcsupport/src/error.c b/c/src/exec/libcsupport/src/error.c index ab4693609e..dd32fb8b66 100644 --- a/c/src/exec/libcsupport/src/error.c +++ b/c/src/exec/libcsupport/src/error.c @@ -115,10 +115,8 @@ static int rtems_verror( if (error_flag & RTEMS_ERROR_PANIC) { - rtems_panic_in_progress++; - - /* disable task switches */ - _Thread_Disable_dispatch(); + if (rtems_panic_in_progress++) + _Thread_Disable_dispatch(); /* disable task switches */ /* don't aggravate things */ if (rtems_panic_in_progress > 2) diff --git a/c/src/lib/libc/error.c b/c/src/lib/libc/error.c index ab4693609e..dd32fb8b66 100644 --- a/c/src/lib/libc/error.c +++ b/c/src/lib/libc/error.c @@ -115,10 +115,8 @@ static int rtems_verror( if (error_flag & RTEMS_ERROR_PANIC) { - rtems_panic_in_progress++; - - /* disable task switches */ - _Thread_Disable_dispatch(); + if (rtems_panic_in_progress++) + _Thread_Disable_dispatch(); /* disable task switches */ /* don't aggravate things */ if (rtems_panic_in_progress > 2) diff --git a/c/src/lib/libmisc/error/error.c b/c/src/lib/libmisc/error/error.c index ab4693609e..dd32fb8b66 100644 --- a/c/src/lib/libmisc/error/error.c +++ b/c/src/lib/libmisc/error/error.c @@ -115,10 +115,8 @@ static int rtems_verror( if (error_flag & RTEMS_ERROR_PANIC) { - rtems_panic_in_progress++; - - /* disable task switches */ - _Thread_Disable_dispatch(); + if (rtems_panic_in_progress++) + _Thread_Disable_dispatch(); /* disable task switches */ /* don't aggravate things */ if (rtems_panic_in_progress > 2) diff --git a/c/src/libmisc/error/error.c b/c/src/libmisc/error/error.c index ab4693609e..dd32fb8b66 100644 --- a/c/src/libmisc/error/error.c +++ b/c/src/libmisc/error/error.c @@ -115,10 +115,8 @@ static int rtems_verror( if (error_flag & RTEMS_ERROR_PANIC) { - rtems_panic_in_progress++; - - /* disable task switches */ - _Thread_Disable_dispatch(); + if (rtems_panic_in_progress++) + _Thread_Disable_dispatch(); /* disable task switches */ /* don't aggravate things */ if (rtems_panic_in_progress > 2) diff --git a/cpukit/libcsupport/src/error.c b/cpukit/libcsupport/src/error.c index ab4693609e..dd32fb8b66 100644 --- a/cpukit/libcsupport/src/error.c +++ b/cpukit/libcsupport/src/error.c @@ -115,10 +115,8 @@ static int rtems_verror( if (error_flag & RTEMS_ERROR_PANIC) { - rtems_panic_in_progress++; - - /* disable task switches */ - _Thread_Disable_dispatch(); + if (rtems_panic_in_progress++) + _Thread_Disable_dispatch(); /* disable task switches */ /* don't aggravate things */ if (rtems_panic_in_progress > 2)