Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix #120, Exit console loop on shutdown #667

Merged
merged 1 commit into from
Dec 9, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion src/os/posix/src/os-impl-console.c
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@

#include "os-shared-idmap.h"
#include "os-shared-printf.h"
#include "os-shared-common.h"

/*
* By default the console output is always asynchronous
Expand Down Expand Up @@ -96,7 +97,9 @@ static void *OS_ConsoleTask_Entry(void *arg)
if (OS_ObjectIdGetById(OS_LOCK_MODE_REFCOUNT, OS_OBJECT_TYPE_OS_CONSOLE, local_arg.id, &token) == OS_SUCCESS)
{
local = OS_OBJECT_TABLE_GET(OS_impl_console_table, token);
while (true)

/* Loop forever (unless shutdown is set) */
while (OS_SharedGlobalVars.ShutdownFlag != OS_SHUTDOWN_MAGIC_NUMBER)
{
OS_ConsoleOutput_Impl(&token);
sem_wait(&local->data_sem);
Expand Down
5 changes: 4 additions & 1 deletion src/os/rtems/src/os-impl-console.c
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
#include "os-rtems.h"
#include "os-shared-printf.h"
#include "os-shared-idmap.h"
#include "os-shared-common.h"

/****************************************************************************************
DEFINES
Expand Down Expand Up @@ -120,7 +121,9 @@ static void OS_ConsoleTask_Entry(rtems_task_argument arg)
OS_SUCCESS)
{
local = OS_OBJECT_TABLE_GET(OS_impl_console_table, token);
while (true)

/* Loop forever (unless shutdown is set) */
while (OS_SharedGlobalVars.ShutdownFlag != OS_SHUTDOWN_MAGIC_NUMBER)
{
OS_ConsoleOutput_Impl(&token);
rtems_semaphore_obtain(local->data_sem, RTEMS_WAIT, RTEMS_NO_TIMEOUT);
Expand Down
5 changes: 4 additions & 1 deletion src/os/vxworks/src/os-impl-console.c
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@

#include "os-shared-printf.h"
#include "os-shared-idmap.h"
#include "os-shared-common.h"

/****************************************************************************************
DEFINES
Expand Down Expand Up @@ -104,7 +105,9 @@ int OS_VxWorks_ConsoleTask_Entry(int arg)
OS_SUCCESS)
{
local = OS_OBJECT_TABLE_GET(OS_impl_console_table, token);
while (true)

/* Loop forever (unless shutdown is set) */
while (OS_SharedGlobalVars.ShutdownFlag != OS_SHUTDOWN_MAGIC_NUMBER)
{
OS_ConsoleOutput_Impl(&token);
if (semTake(local->datasem, WAIT_FOREVER) == ERROR)
Expand Down