summaryrefslogtreecommitdiff
path: root/src/pal
diff options
context:
space:
mode:
Diffstat (limited to 'src/pal')
-rw-r--r--src/pal/inc/pal.h10
-rw-r--r--src/pal/src/CMakeLists.txt1
-rw-r--r--src/pal/src/exception/console.cpp398
-rw-r--r--src/pal/src/exception/seh.cpp28
-rw-r--r--src/pal/src/exception/signal.cpp280
-rw-r--r--src/pal/tests/palsuite/paltestlist_to_be_reviewed.txt7
-rw-r--r--src/pal/tests/palsuite/threading/CMakeLists.txt3
-rw-r--r--src/pal/tests/palsuite/threading/SetConsoleCtrlHandler/CMakeLists.txt10
-rw-r--r--src/pal/tests/palsuite/threading/SetConsoleCtrlHandler/test1/CMakeLists.txt19
-rw-r--r--src/pal/tests/palsuite/threading/SetConsoleCtrlHandler/test1/test1.c86
-rw-r--r--src/pal/tests/palsuite/threading/SetConsoleCtrlHandler/test1/testinfo.dat14
-rw-r--r--src/pal/tests/palsuite/threading/SetConsoleCtrlHandler/test10/CMakeLists.txt19
-rw-r--r--src/pal/tests/palsuite/threading/SetConsoleCtrlHandler/test10/test10.c115
-rw-r--r--src/pal/tests/palsuite/threading/SetConsoleCtrlHandler/test10/testinfo.dat14
-rw-r--r--src/pal/tests/palsuite/threading/SetConsoleCtrlHandler/test4/CMakeLists.txt19
-rw-r--r--src/pal/tests/palsuite/threading/SetConsoleCtrlHandler/test4/test4.c89
-rw-r--r--src/pal/tests/palsuite/threading/SetConsoleCtrlHandler/test4/testinfo.dat14
-rw-r--r--src/pal/tests/palsuite/threading/SetConsoleCtrlHandler/test5/CMakeLists.txt19
-rw-r--r--src/pal/tests/palsuite/threading/SetConsoleCtrlHandler/test5/test5.c264
-rw-r--r--src/pal/tests/palsuite/threading/SetConsoleCtrlHandler/test5/testinfo.dat13
-rw-r--r--src/pal/tests/palsuite/threading/SetConsoleCtrlHandler/test6/CMakeLists.txt19
-rw-r--r--src/pal/tests/palsuite/threading/SetConsoleCtrlHandler/test6/test6.c172
-rw-r--r--src/pal/tests/palsuite/threading/SetConsoleCtrlHandler/test6/testinfo.dat13
-rw-r--r--src/pal/tests/palsuite/threading/SetConsoleCtrlHandler/test7/CMakeLists.txt19
-rw-r--r--src/pal/tests/palsuite/threading/SetConsoleCtrlHandler/test7/test7.c194
-rw-r--r--src/pal/tests/palsuite/threading/SetConsoleCtrlHandler/test7/testinfo.dat15
-rw-r--r--src/pal/tests/palsuite/threading/SetConsoleCtrlHandler/test8/CMakeLists.txt19
-rw-r--r--src/pal/tests/palsuite/threading/SetConsoleCtrlHandler/test8/test8.c192
-rw-r--r--src/pal/tests/palsuite/threading/SetConsoleCtrlHandler/test8/testinfo.dat14
-rw-r--r--src/pal/tests/palsuite/threading/WaitForMultipleObjects/CMakeLists.txt1
-rw-r--r--src/pal/tests/palsuite/threading/WaitForMultipleObjects/test2/CMakeLists.txt19
-rw-r--r--src/pal/tests/palsuite/threading/WaitForMultipleObjects/test2/test2.c140
-rw-r--r--src/pal/tests/palsuite/threading/WaitForMultipleObjects/test2/testinfo.dat13
33 files changed, 1 insertions, 2251 deletions
diff --git a/src/pal/inc/pal.h b/src/pal/inc/pal.h
index efefd4c281..9e44eca30f 100644
--- a/src/pal/inc/pal.h
+++ b/src/pal/inc/pal.h
@@ -480,10 +480,9 @@ typedef long time_t;
#define PAL_INITIALIZE_NONE 0x00
#define PAL_INITIALIZE_SYNC_THREAD 0x01
-#define PAL_INITIALIZE_SIGNAL_THREAD 0x02
// PAL_Initialize() flags
-#define PAL_INITIALIZE PAL_INITIALIZE_SYNC_THREAD | PAL_INITIALIZE_SIGNAL_THREAD
+#define PAL_INITIALIZE PAL_INITIALIZE_SYNC_THREAD
// PAL_InitializeDLL() flags - don't start any of the helper threads
#define PAL_INITIALIZE_DLL PAL_INITIALIZE_NONE
@@ -777,13 +776,6 @@ BOOL
DWORD CtrlType
);
-PALIMPORT
-BOOL
-PALAPI
-SetConsoleCtrlHandler(
- IN PHANDLER_ROUTINE HandlerRoutine,
- IN BOOL Add);
-
#ifndef CORECLR
PALIMPORT
BOOL
diff --git a/src/pal/src/CMakeLists.txt b/src/pal/src/CMakeLists.txt
index 03b3ea694b..0191a992d3 100644
--- a/src/pal/src/CMakeLists.txt
+++ b/src/pal/src/CMakeLists.txt
@@ -106,7 +106,6 @@ set(SOURCES
cruntime/wchar.cpp
cruntime/wchartls.cpp
debug/debug.cpp
- exception/console.cpp
exception/seh.cpp
exception/signal.cpp
file/directory.cpp
diff --git a/src/pal/src/exception/console.cpp b/src/pal/src/exception/console.cpp
deleted file mode 100644
index b4b02fed1f..0000000000
--- a/src/pal/src/exception/console.cpp
+++ /dev/null
@@ -1,398 +0,0 @@
-//
-// Copyright (c) Microsoft. All rights reserved.
-// Licensed under the MIT license. See LICENSE file in the project root for full license information.
-//
-
-/*++
-
-
-
-Module Name:
-
- console.cpp
-
-Abstract:
-
- Implementation of console ctrl API functions.
-
-
-
---*/
-
-#include "pal/thread.hpp"
-#include "pal/dbgmsg.h"
-#include "pal/malloc.hpp"
-#include "pal/process.h"
-#include <errno.h>
-
-using namespace CorUnix;
-
-SET_DEFAULT_DEBUG_CHANNEL(EXCEPT);
-
-/* Constant and type definitions **********************************************/
-
-typedef struct CTRL_HANDLER_LIST
-{
- PHANDLER_ROUTINE handler;
- struct CTRL_HANDLER_LIST *next;
-} CTRL_HANDLER_LIST;
-
-/* Static variables ***********************************************************/
-
-/* for manipulating process control-handler list, etc */
-CRITICAL_SECTION exception_critsec;
-
-static CTRL_HANDLER_LIST * pCtrlHandler;
-static int nCtrlHandlerListLength;
-
-/* Internal function definitions **********************************************/
-
-/*++
-Function :
- SEHInitializeConsole
-
- Initialize stuff related to console ctrl events
-
- (no parameters)
-
-Return value :
- TRUE if initialization succeeded
- FALSE otherwise
---*/
-BOOL SEHInitializeConsole()
-{
- pCtrlHandler = NULL;
- nCtrlHandlerListLength = 0;
- InternalInitializeCriticalSection(&exception_critsec);
- return TRUE;
-}
-
-/* PAL function definitions ***************************************************/
-
-/*++
-Function:
- SetConsoleCtrlHandler
-
-See MSDN doc.
-
---*/
-BOOL
-PALAPI
-SetConsoleCtrlHandler(
- IN PHANDLER_ROUTINE HandlerRoutine,
- IN BOOL Add)
-{
- BOOL retval = FALSE;
- CTRL_HANDLER_LIST *handler;
- CPalThread * pThread;
-
- PERF_ENTRY(SetConsoleCtrlHandler);
- ENTRY("SetConsoleCtrlHandler(HandlerRoutine=%p, Add=%d)\n",
- HandlerRoutine, Add);
-
- pThread = InternalGetCurrentThread();
- InternalEnterCriticalSection(pThread, &exception_critsec);
-
- if(NULL == HandlerRoutine)
- {
- ASSERT("HandlerRoutine may not be NULL, control-c-ignoration is not "
- "supported\n");
- goto done;
- }
-
- if(Add)
- {
- handler = (CTRL_HANDLER_LIST *)InternalMalloc(sizeof(CTRL_HANDLER_LIST));
- if(!handler)
- {
- ERROR("PAL_malloc failed! error is %d (%s)\n", errno, strerror(errno));
- SetLastError(ERROR_NOT_ENOUGH_MEMORY);
- goto done;
- }
- handler->handler = HandlerRoutine;
- /* From MSDN :
- "handler functions are called on a last-registered, first-called
- basis". So we can add the new handler at the head of the list. */
- handler->next = pCtrlHandler;
- pCtrlHandler = handler;
- nCtrlHandlerListLength++;
-
- TRACE("Adding Control Handler %p\n", HandlerRoutine);
- retval = TRUE;
- }
- else
- {
- CTRL_HANDLER_LIST *temp_handler;
-
- handler = pCtrlHandler;
- temp_handler = handler;
- while(handler)
- {
- if(handler->handler == HandlerRoutine)
- {
- break;
- }
- temp_handler = handler;
- handler = handler->next;
- }
- if(handler)
- {
- /* temp_handler it the item before the one to remove, unless it was
- first in the list, in which case handler == temp_handler */
- if(handler == temp_handler)
- {
- /* handler to remove was first in the list... */
- nCtrlHandlerListLength--;
- pCtrlHandler = handler->next;
-
- InternalFree(handler);
- TRACE("Removing Control Handler %p from head of list\n",
- HandlerRoutine );
- }
- else
- {
- /* handler was not first in the list... */
- nCtrlHandlerListLength--;
- temp_handler->next = handler->next;
- InternalFree(handler);
- TRACE("Removing Control Handler %p (not head of list)\n",
- HandlerRoutine );
- }
- retval = TRUE;
- }
- else
- {
- WARN("Trying to remove unknown Control Handler %p\n",
- HandlerRoutine);
- SetLastError(ERROR_INVALID_PARAMETER);
- }
- }
-done:
- InternalLeaveCriticalSection(pThread, &exception_critsec);
-
- LOGEXIT("SetConsoleCtrlHandler returns BOOL %d\n", retval);
- PERF_EXIT(SetConsoleCtrlHandler);
- return retval;
-}
-
-#if !HAVE_MACH_EXCEPTIONS
-// TODO: Implement for Mach exceptions. Not in CoreCLR surface area.
-/*++
-Function:
- GenerateConsoleCtrlEvent
-
-See MSDN doc.
-
-PAL specifics :
- dwProcessGroupId must be zero
-
---*/
-BOOL
-PALAPI
-GenerateConsoleCtrlEvent(
- IN DWORD dwCtrlEvent,
- IN DWORD dwProcessGroupId
- )
-{
- int sig;
- BOOL retval = FALSE;
-
- PERF_ENTRY(GenerateConsoleCtrlEvent);
- ENTRY("GenerateConsoleCtrlEvent(dwCtrlEvent=%d, dwProcessGroupId=%#x)\n",
- dwCtrlEvent, dwProcessGroupId);
-
- if(0!=dwProcessGroupId)
- {
- ASSERT("dwProcessGroupId is not 0, this is not supported by the PAL\n");
- SetLastError(ERROR_INVALID_PARAMETER);
- goto done;
- }
- switch(dwCtrlEvent)
- {
- case CTRL_C_EVENT :
- sig = SIGINT;
- break;
- case CTRL_BREAK_EVENT:
- /* Map control-break on SIGQUIT */
- sig = SIGQUIT;
- break;
- default:
- TRACE("got unknown control event\n");
- goto done;
- }
-
- TRACE("sending signal %d to process %d\n", sig, gPID);
- if(-1 == kill(gPID, sig))
- {
- ASSERT("kill() failed; errno is %d (%s)\n",errno, strerror(errno));
- SetLastError(ERROR_INTERNAL_ERROR);
- goto done;
- }
- retval = TRUE;
-done:
- LOGEXIT("GenerateConsoleCtrlEvent returns BOOL %d\n",retval);
- PERF_EXIT(GenerateConsoleCtrlEvent);
- return retval;
-}
-#endif // !HAVE_MACH_EXCEPTIONS
-
-#if !HAVE_MACH_EXCEPTIONS
-// TODO: Implement for Mach exceptions. Not in CoreCLR surface area.
-/*++
-Function :
- SEHHandleControlEvent
-
- handle Control-C and Control-Break events (call handler routines,
- notify debugger)
-
-Parameters :
- DWORD event : event that occurred
- LPVOID eip : instruction pointer when exception occurred
-
-(no return value)
-
-Notes :
- Handlers are called on a last-installed, first called basis, until a
- handler returns TRUE. If no handler returns TRUE (or no handler is
- installed), the default behavior is to call the default handler of
- the corresponding signal.
---*/
-void SEHHandleControlEvent(DWORD event, LPVOID eip)
-{
- /* handler is actually a copy of the original list */
- CTRL_HANDLER_LIST *handler=NULL, *handlertail=NULL, *handlertmp, *newelem;
- BOOL fHandled = FALSE;
-#ifdef _DEBUG
- BOOL fHoldingCritsec = TRUE;
-#endif
-
- CPalThread *pthrCurrent = InternalGetCurrentThread();
- InternalEnterCriticalSection(pthrCurrent, &exception_critsec);
- handlertmp = pCtrlHandler;
-
- /* nCtrlHandlerListLength is guaranteed to be at most 1 less than,
- * and not greater than, actual length.
- * We might get a stack overflow here, if the list is too large
- * However, that will lead us to terminate with an error, which is
- * the default behavior anyway.
- */
- newelem = reinterpret_cast<CTRL_HANDLER_LIST *>(
- alloca(sizeof(CTRL_HANDLER_LIST)*(nCtrlHandlerListLength+1))
- );
-
- // If alloca failed, we terminate
- if (newelem == NULL) {
- ERROR("alloca failed!");
- InternalLeaveCriticalSection(pthrCurrent, &exception_critsec);
-#ifdef _DEBUG
- fHoldingCritsec = FALSE;
-#endif
- goto done;
- }
-
- /* list copying */
- while(NULL!=handlertmp)
- {
- newelem->handler = handlertmp->handler;
- newelem->next = NULL;
-
- /* add the new element to the list */
- if (handler == NULL)
- {
- handler = newelem;
- }
- else
- {
- handlertail->next = newelem;
- }
- handlertail = newelem;
-
- handlertmp = handlertmp->next;
-
- newelem++;
- }
-
- //
- // Once we've copied the handler list it's safe to release this
- // critical section. We cannot call the user handler routines
- // while holding this critsec -- a poorly written control handler
- // may block indefinitely, which, in turn, would prevent graceful
- // shutdown from occurring (as it would not be possible to
- // suspend this thread due to its holding of an internal critical
- // section).
- //
- // Note that this behavior is somewhat different than Windows --
- // where only a single control handler can run at a time. If we
- // need to replicate that behavior we would need to enter a
- // separate, non-internal critical section before calling the
- // control handlers.
- //
-
- InternalLeaveCriticalSection(pthrCurrent, &exception_critsec);
-#ifdef _DEBUG
- fHoldingCritsec = FALSE;
-#endif
-
- /* second, call handler routines until one handles the event */
-
- while(NULL!=handler)
- {
- BOOL handler_retval;
-
-/* reset ENTRY nesting level back to zero while inside the callback... */
-#if _ENABLE_DEBUG_MESSAGES_
- {
- int old_level;
- old_level = DBG_change_entrylevel(0);
-#endif /* _ENABLE_DEBUG_MESSAGES_ */
-
- handler_retval = handler->handler(event);
-
-/* ...and set nesting level back to what it was */
-#if _ENABLE_DEBUG_MESSAGES_
- DBG_change_entrylevel(old_level);
- }
-#endif /* _ENABLE_DEBUG_MESSAGES_ */
-
- if(handler_retval)
- {
- TRACE("Console Control handler %p has handled event\n",
- handler->handler);
- fHandled = TRUE;
- break;
- }
- handler = handler->next;
- }
-
-done:
-#ifdef _DEBUG
- _ASSERT_MSG(!fHoldingCritsec, "Exiting SEHHandleControlEvent while still holding a critical section.\n");
-#endif
- if(!fHandled)
- {
- int signalCode;
-
- if(CTRL_C_EVENT == event)
- {
- TRACE("Control-C not handled; terminating.\n");
- signalCode = SIGINT;
- }
- else
- {
- TRACE("Control-Break not handled; terminating.\n");
- signalCode = SIGQUIT;
- }
-
- // The proper behavior for unhandled SIGINT/SIGQUIT is to set the signal handler to the default one
- // and then send the SIGINT/SIGQUIT to self and let the default handler do its work.
- struct sigaction action;
- action.sa_handler = SIG_DFL;
- action.sa_flags = 0;
- sigemptyset(&action.sa_mask);
- sigaction(signalCode, &action, NULL);
-
- kill(getpid(), signalCode);
- }
-}
-
-#endif // !HAVE_MACH_EXCEPTIONS
diff --git a/src/pal/src/exception/seh.cpp b/src/pal/src/exception/seh.cpp
index 56751cefff..7d9ff08bc0 100644
--- a/src/pal/src/exception/seh.cpp
+++ b/src/pal/src/exception/seh.cpp
@@ -58,16 +58,6 @@ const UINT RESERVED_SEH_BIT = 0x800000;
PHARDWARE_EXCEPTION_HANDLER g_hardwareExceptionHandler = NULL;
-/* Internal function declarations *********************************************/
-
-BOOL SEHInitializeConsole();
-
-#if !HAVE_MACH_EXCEPTIONS
-PAL_ERROR
-StartExternalSignalHandlerThread(
- CPalThread *pthr);
-#endif // !HAVE_MACH_EXCEPTIONS
-
/* Internal function definitions **********************************************/
/*++
@@ -89,13 +79,6 @@ SEHInitialize (CPalThread *pthrCurrent, DWORD flags)
{
BOOL bRet = FALSE;
- if (!SEHInitializeConsole())
- {
- ERROR("SEHInitializeConsole failed!\n");
- SEHCleanup();
- goto SEHInitializeExit;
- }
-
#if !HAVE_MACH_EXCEPTIONS
if (!SEHInitializeSignals())
{
@@ -103,17 +86,6 @@ SEHInitialize (CPalThread *pthrCurrent, DWORD flags)
SEHCleanup();
goto SEHInitializeExit;
}
-
- if (flags & PAL_INITIALIZE_SIGNAL_THREAD)
- {
- PAL_ERROR palError = StartExternalSignalHandlerThread(pthrCurrent);
- if (NO_ERROR != palError)
- {
- ERROR("StartExternalSignalHandlerThread returned %d\n", palError);
- SEHCleanup();
- goto SEHInitializeExit;
- }
- }
#endif
bRet = TRUE;
diff --git a/src/pal/src/exception/signal.cpp b/src/pal/src/exception/signal.cpp
index 7f48fc8384..69519d4a87 100644
--- a/src/pal/src/exception/signal.cpp
+++ b/src/pal/src/exception/signal.cpp
@@ -65,8 +65,6 @@ static void sigfpe_handler(int code, siginfo_t *siginfo, void *context);
static void sigsegv_handler(int code, siginfo_t *siginfo, void *context);
static void sigtrap_handler(int code, siginfo_t *siginfo, void *context);
static void sigbus_handler(int code, siginfo_t *siginfo, void *context);
-static void sigint_handler(int code, siginfo_t *siginfo, void *context);
-static void sigquit_handler(int code, siginfo_t *siginfo, void *context);
static void common_signal_handler(PEXCEPTION_POINTERS pointers, int code,
native_context_t *ucontext);
@@ -83,15 +81,6 @@ struct sigaction g_previous_sigtrap;
struct sigaction g_previous_sigfpe;
struct sigaction g_previous_sigbus;
struct sigaction g_previous_sigsegv;
-struct sigaction g_previous_sigint;
-struct sigaction g_previous_sigquit;
-
-// Pipe used for sending SIGINT / SIGQUIT signals notifications to a helper thread
-// that invokes the actual handler.
-int g_signalPipe[2] = { 0, 0 };
-
-DWORD g_dwExternalSignalHandlerThreadId = 0;
-
/* public function definitions ************************************************/
@@ -173,14 +162,6 @@ void SEHCleanupSignals()
restore_signal(SIGFPE, &g_previous_sigfpe);
restore_signal(SIGBUS, &g_previous_sigbus);
restore_signal(SIGSEGV, &g_previous_sigsegv);
-
- // Only restore these signals if the signal handler thread was started and
- // the previous handlers saved.
- if (g_dwExternalSignalHandlerThreadId != 0)
- {
- restore_signal(SIGINT, &g_previous_sigint);
- restore_signal(SIGQUIT, &g_previous_sigquit);
- }
}
/* internal function definitions **********************************************/
@@ -376,91 +357,6 @@ static void sigtrap_handler(int code, siginfo_t *siginfo, void *context)
/*++
Function :
- HandleExternalSignal
-
- Handle the SIGINT and SIGQUIT signals.
-
-
-Parameters :
- signalCode - code of the external signal
-
- (no return value)
---*/
-static void HandleExternalSignal(int signalCode)
-{
- BYTE signalCodeByte = (BYTE)signalCode;
- ssize_t writtenBytes;
- do
- {
- writtenBytes = write(g_signalPipe[1], &signalCodeByte, 1);
- }
- while ((writtenBytes == -1) && (errno == EINTR));
-
- if (writtenBytes == -1)
- {
- // Fatal error
- abort();
- }
-}
-
-/*++
-Function :
- sigint_handler
-
- handle SIGINT signal
-
-Parameters :
- POSIX signal handler parameter list ("man sigaction" for details)
-
- (no return value)
---*/
-static void sigint_handler(int code, siginfo_t *siginfo, void *context)
-{
- if (PALIsInitialized())
- {
- HandleExternalSignal(code);
- }
- else
- {
- TRACE("SIGINT signal was unhandled; chaining to previous sigaction\n");
-
- if (g_previous_sigint.sa_sigaction != NULL)
- {
- g_previous_sigint.sa_sigaction(code, siginfo, context);
- }
- }
-}
-
-/*++
-Function :
- sigquit_handler
-
- handle SIGQUIT signal
-
-Parameters :
- POSIX signal handler parameter list ("man sigaction" for details)
-
- (no return value)
---*/
-static void sigquit_handler(int code, siginfo_t *siginfo, void *context)
-{
- if (PALIsInitialized())
- {
- HandleExternalSignal(code);
- }
- else
- {
- TRACE("SIGQUIT signal was unhandled; chaining to previous sigaction\n");
-
- if (g_previous_sigquit.sa_sigaction != NULL)
- {
- g_previous_sigquit.sa_sigaction(code, siginfo, context);
- }
- }
-}
-
-/*++
-Function :
sigbus_handler
handle SIGBUS signal (EXCEPTION_ACCESS_VIOLATION?)
@@ -723,180 +619,4 @@ void restore_signal(int signal_id, struct sigaction *previousAction)
}
}
-static
-DWORD
-PALAPI
-ExternalSignalHandlerThreadRoutine(
- PVOID
- );
-
-static
-DWORD
-PALAPI
-ControlHandlerThreadRoutine(
- PVOID pvSignal
- );
-
-PAL_ERROR
-StartExternalSignalHandlerThread(
- CPalThread *pthr)
-{
- PAL_ERROR palError = NO_ERROR;
-
-#ifndef DO_NOT_USE_SIGNAL_HANDLING_THREAD
- HANDLE hThread;
-
- if (pipe(g_signalPipe) != 0)
- {
- palError = ERROR_CANNOT_MAKE;
- goto done;
- }
-
- palError = InternalCreateThread(
- pthr,
- NULL,
- 0,
- ExternalSignalHandlerThreadRoutine,
- NULL,
- 0,
- SignalHandlerThread, // Want no_suspend variant
- &g_dwExternalSignalHandlerThreadId,
- &hThread
- );
-
- if (NO_ERROR != palError)
- {
- ERROR("Failure creating external signal handler thread (%d)\n", palError);
- goto done;
- }
-
- InternalCloseHandle(pthr, hThread);
-
- handle_signal(SIGINT, sigint_handler, &g_previous_sigint);
- handle_signal(SIGQUIT, sigquit_handler, &g_previous_sigquit);
-#endif // DO_NOT_USE_SIGNAL_HANDLING_THREAD
-
-done:
-
- return palError;
-}
-
-static
-DWORD
-PALAPI
-ExternalSignalHandlerThreadRoutine(
- PVOID
- )
-{
- DWORD dwThreadId;
- bool fContinue = TRUE;
- HANDLE hThread;
- PAL_ERROR palError = NO_ERROR;
- CPalThread *pthr = InternalGetCurrentThread();
-
- //
- // Wait for a signal to occur
- //
-
- while (fContinue)
- {
- BYTE signalCode;
- ssize_t bytesRead;
-
- do
- {
- bytesRead = read(g_signalPipe[0], &signalCode, 1);
- }
- while ((bytesRead == -1) && (errno == EINTR));
-
- if (bytesRead == -1)
- {
- // Fatal error
- abort();
- }
-
- switch (signalCode)
- {
- case SIGINT:
- case SIGQUIT:
- {
- //
- // Spin up a new thread to run the console handlers. We want
- // to do this even if no handlers are installed, as in that
- // case we want to do a normal shutdown from the new thread
- // while still having this thread available to handle any
- // other incoming signals.
- //
- // The new thread is always spawned, even if there are already
- // currently console handlers running; this follows the
- // Windows behavior. Yes, this means that poorly written
- // console handler routines can make it impossible to kill
- // a process using Ctrl-C or Ctrl-Break. "kill -9" is
- // your friend.
- //
- // This thread must not be marked as a PalWorkerThread --
- // since it may run user code it needs to make
- // DLL_THREAD_ATTACH notifications.
- //
-
- PVOID pvCtrlCode = UintToPtr(
- SIGINT == signalCode ? CTRL_C_EVENT : CTRL_BREAK_EVENT
- );
-
- palError = InternalCreateThread(
- pthr,
- NULL,
- 0,
- ControlHandlerThreadRoutine,
- pvCtrlCode,
- 0,
- UserCreatedThread,
- &dwThreadId,
- &hThread
- );
-
- if (NO_ERROR != palError)
- {
- if (!PALIsShuttingDown())
- {
- // If PAL is not shutting down, failure to create a thread is
- // a fatal error.
- abort();
- }
- fContinue = FALSE;
- break;
- }
-
- InternalCloseHandle(pthr, hThread);
- break;
- }
-
- default:
- ASSERT("Unexpected signal %d in signal thread\n", signalCode);
- abort();
- break;
- }
- }
-
- //
- // Perform an immediate (non-graceful) shutdown
- //
-
- _exit(EXIT_FAILURE);
-
- return 0;
-}
-
-static
-DWORD
-PALAPI
-ControlHandlerThreadRoutine(
- PVOID pvSignal
- )
-{
- // Uint and DWORD are implicitly the same.
- SEHHandleControlEvent(PtrToUint(pvSignal), NULL);
- return 0;
-}
-
#endif // !HAVE_MACH_EXCEPTIONS
diff --git a/src/pal/tests/palsuite/paltestlist_to_be_reviewed.txt b/src/pal/tests/palsuite/paltestlist_to_be_reviewed.txt
index f638e96502..e7ccda5e7f 100644
--- a/src/pal/tests/palsuite/paltestlist_to_be_reviewed.txt
+++ b/src/pal/tests/palsuite/paltestlist_to_be_reviewed.txt
@@ -194,13 +194,6 @@ threading/OpenEventW/test4/paltest_openeventw_test4
threading/OpenEventW/test5/paltest_openeventw_test5
threading/OpenProcess/test1/paltest_openprocess_test1
threading/QueueUserAPC/test1/paltest_queueuserapc_test1
-threading/SetConsoleCtrlHandler/test1/paltest_setconsolectrlhandler_test1
-threading/SetConsoleCtrlHandler/test10/paltest_setconsolectrlhandler_test10
-threading/SetConsoleCtrlHandler/test4/paltest_setconsolectrlhandler_test4
-threading/SetConsoleCtrlHandler/test5/paltest_setconsolectrlhandler_test5
-threading/SetConsoleCtrlHandler/test6/paltest_setconsolectrlhandler_test6
-threading/SetConsoleCtrlHandler/test7/paltest_setconsolectrlhandler_test7
-threading/SetConsoleCtrlHandler/test8/paltest_setconsolectrlhandler_test8
threading/setthreadcontext/test1/paltest_setthreadcontext_test1
threading/SuspendThread/test2/paltest_suspendthread_test2
threading/SuspendThread/test3/paltest_suspendthread_test3
diff --git a/src/pal/tests/palsuite/threading/CMakeLists.txt b/src/pal/tests/palsuite/threading/CMakeLists.txt
index 7ce2b2df90..a9bd91c9f3 100644
--- a/src/pal/tests/palsuite/threading/CMakeLists.txt
+++ b/src/pal/tests/palsuite/threading/CMakeLists.txt
@@ -1,8 +1,5 @@
cmake_minimum_required(VERSION 2.8.12.2)
-# TODO: make these tests compile if they are needed
-# add_subdirectory(SetConsoleCtrlHandler)
-
add_subdirectory(CreateEventA)
add_subdirectory(CreateEventW)
add_subdirectory(CreateMutexA_ReleaseMutex)
diff --git a/src/pal/tests/palsuite/threading/SetConsoleCtrlHandler/CMakeLists.txt b/src/pal/tests/palsuite/threading/SetConsoleCtrlHandler/CMakeLists.txt
deleted file mode 100644
index 75b3393664..0000000000
--- a/src/pal/tests/palsuite/threading/SetConsoleCtrlHandler/CMakeLists.txt
+++ /dev/null
@@ -1,10 +0,0 @@
-cmake_minimum_required(VERSION 2.8.12.2)
-
-add_subdirectory(test1)
-add_subdirectory(test10)
-add_subdirectory(test4)
-add_subdirectory(test5)
-add_subdirectory(test6)
-add_subdirectory(test7)
-add_subdirectory(test8)
-
diff --git a/src/pal/tests/palsuite/threading/SetConsoleCtrlHandler/test1/CMakeLists.txt b/src/pal/tests/palsuite/threading/SetConsoleCtrlHandler/test1/CMakeLists.txt
deleted file mode 100644
index a12b8264f5..0000000000
--- a/src/pal/tests/palsuite/threading/SetConsoleCtrlHandler/test1/CMakeLists.txt
+++ /dev/null
@@ -1,19 +0,0 @@
-cmake_minimum_required(VERSION 2.8.12.2)
-
-set(CMAKE_INCLUDE_CURRENT_DIR ON)
-
-set(SOURCES
- test1.c
-)
-
-add_executable(paltest_setconsolectrlhandler_test1
- ${SOURCES}
-)
-
-add_dependencies(paltest_setconsolectrlhandler_test1 coreclrpal)
-
-target_link_libraries(paltest_setconsolectrlhandler_test1
- pthread
- m
- coreclrpal
-)
diff --git a/src/pal/tests/palsuite/threading/SetConsoleCtrlHandler/test1/test1.c b/src/pal/tests/palsuite/threading/SetConsoleCtrlHandler/test1/test1.c
deleted file mode 100644
index 08ce81ca45..0000000000
--- a/src/pal/tests/palsuite/threading/SetConsoleCtrlHandler/test1/test1.c
+++ /dev/null
@@ -1,86 +0,0 @@
-//
-// Copyright (c) Microsoft. All rights reserved.
-// Licensed under the MIT license. See LICENSE file in the project root for full license information.
-//
-
-/*=====================================================================
-**
-** Source: test1.c
-**
-** Purpose: Set the CtrlHandler to flip a flag
-** when CTRL_C_EVENT is signalled. If the flag is flipped, the test
-** succeeds. Otherwise, it will fail. Finally, check to see that
-** removing the handler works alright.
-**
-**
-**===================================================================*/
-
-#include <palsuite.h>
-
-int Flag = 1;
-
-BOOL CtrlHandler(DWORD CtrlType)
-{
- if(CtrlType == CTRL_C_EVENT)
- {
- Flag = 0;
- return 1;
- }
-
- Trace("ERROR: The CtrlHandler was called, but the event was not a "
- "CTRL_C_EVENT. This is considered failure.\n");
-
- return 0;
-}
-
-int __cdecl main(int argc, char **argv)
-{
-
- if (0 != PAL_Initialize(argc,argv))
- {
- return FAIL;
- }
-
- /* Call the function to set the CtrlHandler */
- if( SetConsoleCtrlHandler((PHANDLER_ROUTINE) CtrlHandler, TRUE) == 0 )
- {
- Fail("ERROR: SetConsoleCtrlHandler returned zero, indicating failure."
- " GetLastError() returned %d.\n",GetLastError());
- }
-
- /* Generate a CTRL_C event */
- if(GenerateConsoleCtrlEvent(CTRL_C_EVENT, 0) == 0)
- {
- Fail("ERROR: GenerateConsoleCtrlEvent failed, returning zero. "
- "GetLastError returned %d.\n",GetLastError());
- }
-
-
- /* Sleep for a couple seconds to ensure that the event has time to
- complete.
- */
- Sleep(2000);
-
- /* The event handling function should set Flag = 0 if it worked
- properly. Otherwise this test fails.
- */
- if(Flag)
- {
- Fail("ERROR: When CTRL-C was generated it wasn't handled by the "
- "Ctrl Handler which was defined.\n");
- }
-
-
- /* Call the function to remove the CtrlHandler */
-
- if( SetConsoleCtrlHandler((PHANDLER_ROUTINE) CtrlHandler, FALSE) == 0)
- {
- Fail("ERROR: SetConsoleCtrlHandler returned zero, indicating failure "
- "when attempting to remove a handler. "
- "GetLastError() returned %d.\n",GetLastError());
- }
-
- PAL_Terminate();
- return PASS;
-}
-
diff --git a/src/pal/tests/palsuite/threading/SetConsoleCtrlHandler/test1/testinfo.dat b/src/pal/tests/palsuite/threading/SetConsoleCtrlHandler/test1/testinfo.dat
deleted file mode 100644
index 04088663ed..0000000000
--- a/src/pal/tests/palsuite/threading/SetConsoleCtrlHandler/test1/testinfo.dat
+++ /dev/null
@@ -1,14 +0,0 @@
-#
-# Copyright (c) Microsoft Corporation. All rights reserved.
-#
-
-Version = 1.0
-Section = threading
-Function = SetConsoleCtrlHandler
-Name = See that CTRL-C behaviour can be set using this function.
-TYPE = DEFAULT
-EXE1 = test1
-Description
-= Set the CtrlHandler to flip a flag
-= when CTRL_C_EVENT is signalled. If the flag is flipped, the test
-= succeeds. Otherwise, it will fail.
diff --git a/src/pal/tests/palsuite/threading/SetConsoleCtrlHandler/test10/CMakeLists.txt b/src/pal/tests/palsuite/threading/SetConsoleCtrlHandler/test10/CMakeLists.txt
deleted file mode 100644
index 3a12c845ec..0000000000
--- a/src/pal/tests/palsuite/threading/SetConsoleCtrlHandler/test10/CMakeLists.txt
+++ /dev/null
@@ -1,19 +0,0 @@
-cmake_minimum_required(VERSION 2.8.12.2)
-
-set(CMAKE_INCLUDE_CURRENT_DIR ON)
-
-set(SOURCES
- test10.c
-)
-
-add_executable(paltest_setconsolectrlhandler_test10
- ${SOURCES}
-)
-
-add_dependencies(paltest_setconsolectrlhandler_test10 coreclrpal)
-
-target_link_libraries(paltest_setconsolectrlhandler_test10
- pthread
- m
- coreclrpal
-)
diff --git a/src/pal/tests/palsuite/threading/SetConsoleCtrlHandler/test10/test10.c b/src/pal/tests/palsuite/threading/SetConsoleCtrlHandler/test10/test10.c
deleted file mode 100644
index 67c9f56368..0000000000
--- a/src/pal/tests/palsuite/threading/SetConsoleCtrlHandler/test10/test10.c
+++ /dev/null
@@ -1,115 +0,0 @@
-//
-// Copyright (c) Microsoft. All rights reserved.
-// Licensed under the MIT license. See LICENSE file in the project root for full license information.
-//
-
-/*=============================================================================
-**
-** Source: test10.c
-**
-** Dependencies: PAL_Initialize
-** PAL_Terminate
-** GenerateConsoleCtrlEvent
-**
-** Purpose:
-**
-** Test to ensure proper operation of the SetConsoleCtrlHandler()
-** API by checking whether a console control handler function is
-** actually removed by the API when it returns success for that
-** operation.
-**
-
-**
-**===========================================================================*/
-#include <palsuite.h>
-
-
-
-/* global test value */
-static BOOL g_bFlag = FALSE;
-
-
-
-/* handler function */
-static BOOL PALAPI CtrlHandler( DWORD CtrlType )
-{
- if( CtrlType == CTRL_BREAK_EVENT )
- {
- g_bFlag = TRUE;
- return TRUE;
- }
-
- return FALSE;
-}
-
-
-
-
-
-/* main entry point function */
-int __cdecl main( int argc, char **argv )
-
-{
- /* local variables */
- BOOL ret = PASS;
-
-
- /* PAL initialization */
- if( (PAL_Initialize(argc, argv)) != 0 )
- {
- return( FAIL );
- }
-
-
- /* set the console control handler function */
- if( ! SetConsoleCtrlHandler( CtrlHandler, TRUE ) )
- {
- ret = FAIL;
- Trace( "ERROR:%lu:SetConsoleCtrlHandler() failed to add "
- "CtrlHandler\n",
- GetLastError() );
- Fail( "Test failed\n" );
- }
-
-
- /* test that the right control handler functions are set */
- if( ! GenerateConsoleCtrlEvent( CTRL_BREAK_EVENT, 0 ) )
- {
- Trace( "ERROR:%lu:GenerateConsoleCtrlEvent() failed\n",
- GetLastError() );
- ret = FAIL;
- goto done;
- }
-
- /* give the handlers a chance to execute */
- Sleep( 2000 );
-
- /* check the results */
- if( ! g_bFlag )
- {
- Trace( "ERROR:CtrlHandler() was not called but should have been\n" );
- ret = FAIL;
- }
-
-
-
-done:
- /* unset the control handle that was set */
- if( ! SetConsoleCtrlHandler( CtrlHandler, FALSE ) )
- {
- ret = FAIL;
- Trace( "ERROR:%lu:SetConsoleCtrlHandler() failed to "
- "remove CtrlHandler\n",
- GetLastError() );
- Fail( "Test failed\n" );
- }
-
-
- /* PAL termination */
- PAL_TerminateEx(ret);
-
-
- /* return our result */
- return ret;
-}
-
diff --git a/src/pal/tests/palsuite/threading/SetConsoleCtrlHandler/test10/testinfo.dat b/src/pal/tests/palsuite/threading/SetConsoleCtrlHandler/test10/testinfo.dat
deleted file mode 100644
index e1eafb6e38..0000000000
--- a/src/pal/tests/palsuite/threading/SetConsoleCtrlHandler/test10/testinfo.dat
+++ /dev/null
@@ -1,14 +0,0 @@
-#
-# Copyright (c) Microsoft Corporation. All rights reserved.
-#
-
-Version = 1.0
-Section = threading
-Function = SetConsoleCtrlHandler
-Name = Positive test for SetConsoleCtrlHandler
-TYPE = DEFAULT
-EXE1 = test10
-Description
-= Test to ensure proper operation of the SetConsoleCtrlHandler()
-= API by checking whether a console control handler function can
-= be set and called for a CTRL_BREAK_EVENT.
diff --git a/src/pal/tests/palsuite/threading/SetConsoleCtrlHandler/test4/CMakeLists.txt b/src/pal/tests/palsuite/threading/SetConsoleCtrlHandler/test4/CMakeLists.txt
deleted file mode 100644
index 9c02d5ba0f..0000000000
--- a/src/pal/tests/palsuite/threading/SetConsoleCtrlHandler/test4/CMakeLists.txt
+++ /dev/null
@@ -1,19 +0,0 @@
-cmake_minimum_required(VERSION 2.8.12.2)
-
-set(CMAKE_INCLUDE_CURRENT_DIR ON)
-
-set(SOURCES
- test4.c
-)
-
-add_executable(paltest_setconsolectrlhandler_test4
- ${SOURCES}
-)
-
-add_dependencies(paltest_setconsolectrlhandler_test4 coreclrpal)
-
-target_link_libraries(paltest_setconsolectrlhandler_test4
- pthread
- m
- coreclrpal
-)
diff --git a/src/pal/tests/palsuite/threading/SetConsoleCtrlHandler/test4/test4.c b/src/pal/tests/palsuite/threading/SetConsoleCtrlHandler/test4/test4.c
deleted file mode 100644
index 6368bbc659..0000000000
--- a/src/pal/tests/palsuite/threading/SetConsoleCtrlHandler/test4/test4.c
+++ /dev/null
@@ -1,89 +0,0 @@
-//
-// Copyright (c) Microsoft. All rights reserved.
-// Licensed under the MIT license. See LICENSE file in the project root for full license information.
-//
-
-/*=====================================================================
-**
-** Source: test1.c
-**
-** Purpose: This is a MANUAL test. This is also a NEGATIVE test. We want
-** this function to return 1 (FAIL). This test checks that we can set a
-** handler for CTRL_C and then remove that handler.
-**
-**
-**===================================================================*/
-
-/* Note: If an error occurs in this test, we have to return 0.
- The only time this test passes, is when CTRL-C is signaled, and the
- program exits with a code of 1.
-*/
-
-#include <palsuite.h>
-
-int Flag = 1;
-
-BOOL CtrlHandler(DWORD CtrlType)
-{
- if(CtrlType == CTRL_C_EVENT)
- {
- Flag = 0;
- return 1;
- }
-
- Trace("ERROR: The CtrlHandler was called, but the event was not a "
- "CTRL_C_EVENT. This is considered failure.");
-
- return 0;
-}
-
-int __cdecl main(int argc, char **argv)
-{
- int counter = 0;
-
- if (0 != PAL_Initialize(argc,argv))
- {
- return FAIL;
- }
-
- /* Call the function to set the CtrlHandler */
- if( SetConsoleCtrlHandler((PHANDLER_ROUTINE) CtrlHandler, TRUE) == 0 )
- {
- Trace("ERROR: SetConsoleCtrlHandler returned zero, indicating failure."
- " GetLastError() returned %d.\n",GetLastError());
- return 0;
- }
-
- /* Call the function to remove the CtrlHandler */
-
- if( SetConsoleCtrlHandler((PHANDLER_ROUTINE) CtrlHandler, FALSE) == 0)
- {
- Trace("ERROR: SetConsoleCtrlHandler returned zero, indicating failure "
- "when attempting to remove a handler. "
- "GetLastError() returned %d.\n",GetLastError());
- return 0;
- }
-
- /* Prompt for the tester to press CTRL-C. They have a limited amount
- of time to type this. (Incase the CTRL-C handler isn't working
- properly)
- */
- printf("Please press CTRL-C now. This is timed. If CTRL-C is not "
- "pressed by the time I count to 1000000000 then the test "
- "will automatically fail.\n");
-
- while(Flag)
- {
- counter++;
- if(counter == 1000000000)
- {
- Trace("ERROR: The time ran out. CTRL-C was never pressed.");
- return 0;
- }
- }
-
- Trace("MANUAL: The test has failed. Now calling PAL_Terminate().\n");
- PAL_Terminate();
- return 0;
-}
-
diff --git a/src/pal/tests/palsuite/threading/SetConsoleCtrlHandler/test4/testinfo.dat b/src/pal/tests/palsuite/threading/SetConsoleCtrlHandler/test4/testinfo.dat
deleted file mode 100644
index 7169ee3556..0000000000
--- a/src/pal/tests/palsuite/threading/SetConsoleCtrlHandler/test4/testinfo.dat
+++ /dev/null
@@ -1,14 +0,0 @@
-#
-# Copyright (c) Microsoft Corporation. All rights reserved.
-#
-
-Version = 1.0
-Section = threading
-Function = SetConsoleCtrlHandler
-Name = Manual/Negative Test to see that CTRL-C behaviour can be set/unset.
-TYPE = DEFAULT
-EXE1 = test4
-Description
-= This is a MANUAL test. This is also a NEGATIVE test. We want
-= this function to return 1 (FAIL). This test checks that we can set a
-= handler for CTRL_C and then remove that handler.
diff --git a/src/pal/tests/palsuite/threading/SetConsoleCtrlHandler/test5/CMakeLists.txt b/src/pal/tests/palsuite/threading/SetConsoleCtrlHandler/test5/CMakeLists.txt
deleted file mode 100644
index 1a5ebd71b6..0000000000
--- a/src/pal/tests/palsuite/threading/SetConsoleCtrlHandler/test5/CMakeLists.txt
+++ /dev/null
@@ -1,19 +0,0 @@
-cmake_minimum_required(VERSION 2.8.12.2)
-
-set(CMAKE_INCLUDE_CURRENT_DIR ON)
-
-set(SOURCES
- test5.c
-)
-
-add_executable(paltest_setconsolectrlhandler_test5
- ${SOURCES}
-)
-
-add_dependencies(paltest_setconsolectrlhandler_test5 coreclrpal)
-
-target_link_libraries(paltest_setconsolectrlhandler_test5
- pthread
- m
- coreclrpal
-)
diff --git a/src/pal/tests/palsuite/threading/SetConsoleCtrlHandler/test5/test5.c b/src/pal/tests/palsuite/threading/SetConsoleCtrlHandler/test5/test5.c
deleted file mode 100644
index 4355cdb29d..0000000000
--- a/src/pal/tests/palsuite/threading/SetConsoleCtrlHandler/test5/test5.c
+++ /dev/null
@@ -1,264 +0,0 @@
-//
-// Copyright (c) Microsoft. All rights reserved.
-// Licensed under the MIT license. See LICENSE file in the project root for full license information.
-//
-
-/*=============================================================================
-**
-** Source: test5.c
-**
-** Dependencies: PAL_Initialize
-** PAL_Terminate
-** GenerateConsoleCtrlEvent
-**
-** Purpose:
-**
-** Test to ensure proper operation of the SetConsoleCtrlHandler()
-** API by using it to chain multiple handler functions together.
-**
-
-**
-**===========================================================================*/
-#include <palsuite.h>
-
-
-/* helper test structure */
-struct handlerData
-{
- PHANDLER_ROUTINE func; /* handler routine */
- BOOL set; /* whether this handler was set */
- BOOL stop; /* whether handling should stop with this */
- BOOL result; /* flag tracking whether handler was called */
-};
-
-
-/* we'll work with three handler functions */
-#define NUM_HANDLERS 3
-
-/* handler function prototypes */
-static BOOL PALAPI CtrlHandler1( DWORD CtrlType );
-static BOOL PALAPI CtrlHandler2( DWORD CtrlType );
-static BOOL PALAPI CtrlHandler3( DWORD CtrlType );
-
-
-/* array of control handler data */
-static struct handlerData g_handlers[] =
-{
- { CtrlHandler1, FALSE, TRUE, FALSE },
- { CtrlHandler2, FALSE, FALSE, FALSE },
- { CtrlHandler3, FALSE, FALSE, FALSE }
-};
-
-
-/* global flag to track whether the handlers are called in the wrong order */
-static BOOL g_bWrongOrder = FALSE;
-
-
-/* first handler function */
-static BOOL PALAPI CtrlHandler1( DWORD CtrlType )
-{
- if( CtrlType == CTRL_C_EVENT )
- {
- /* set our handler flag to true */
- g_handlers[0].result = TRUE;
-
- /* check for right handler order */
- if( (!g_handlers[1].result) || (!g_handlers[2].result) )
- {
- g_bWrongOrder = TRUE;
- }
- return g_handlers[0].stop;
- }
-
- return FALSE;
-}
-
-
-/* second handler function */
-static BOOL PALAPI CtrlHandler2( DWORD CtrlType )
-{
- if( CtrlType == CTRL_C_EVENT )
- {
- /* set our handler flag to true */
- g_handlers[1].result = TRUE;
-
- /* check for right handler order */
- if( g_handlers[0].result || (!g_handlers[2].result) )
- {
- g_bWrongOrder = TRUE;
- }
- return g_handlers[1].stop;
- }
-
- return FALSE;
-}
-
-
-/* third handler function */
-static BOOL PALAPI CtrlHandler3( DWORD CtrlType )
-{
- if( CtrlType == CTRL_C_EVENT )
- {
- /* set our handler flag to true */
- g_handlers[2].result = TRUE;
-
- /* check for right handler order */
- if( g_handlers[0].result || g_handlers[1].result )
- {
- g_bWrongOrder = TRUE;
- }
- return g_handlers[2].stop;
- }
-
- return FALSE;
-}
-
-
-
-
-
-
-/* main entry point function */
-int __cdecl main( int argc, char **argv )
-
-{
- /* local variables */
- int i;
- int finalHandler;
- BOOL ret = PASS;
-
-
- /* PAL initialization */
- if( (PAL_Initialize(argc, argv)) != 0 )
- {
- return( FAIL );
- }
-
-
- /* chain together three simple control handlers */
- for( i=0; i<NUM_HANDLERS; i++ )
- {
- if( SetConsoleCtrlHandler( g_handlers[i].func, TRUE ) )
- {
- g_handlers[i].set = TRUE;
- }
- else
- {
- ret = FAIL;
- Trace( "ERROR:%lu:SetConsoleCtrlHandler() failed to add "
- "handler #%d\n",
- GetLastError(),
- (i+1) );
- goto done;
- }
- }
-
-
- /* first test -- verify that all three handlers are called, in the */
- /* correct sequence (CtrlHandler3, CtrlHandler2, CtrlHandler1) */
- if( ! GenerateConsoleCtrlEvent( CTRL_C_EVENT, 0 ) )
- {
- Trace( "ERROR:%lu:GenerateConsoleCtrlEvent() failed\n",
- GetLastError() );
- ret = FAIL;
- goto done;
- }
-
- /* give the handlers a chance to execute */
- Sleep( 2000 );
-
-
- /* check the results and reset all the handler-called flags */
- for( i=0; i<NUM_HANDLERS; i++ )
- {
- if( ! g_handlers[i].result )
- {
- Trace( "FAIL:Handler #%d was not called\n", (i+1) );
- ret = FAIL;
- }
- else
- {
- g_handlers[i].result = FALSE;
- }
- }
-
- if( g_bWrongOrder )
- {
- Trace( "FAIL:Handlers were called in the wrong order\n" );
- ret = FAIL;
- }
-
- /* we're done if we got an error result */
- if( ! ret )
- {
- goto done;
- }
-
-
- /* same test, only this time we want to stop at the second handler */
- finalHandler = 1;
- g_handlers[ finalHandler ].stop = TRUE;
- if( ! GenerateConsoleCtrlEvent( CTRL_C_EVENT, 0 ) )
- {
- Trace( "ERROR:%lu:GenerateConsoleCtrlEvent() failed\n",
- GetLastError() );
- ret = FAIL;
- goto done;
- }
-
- /* give the handlers a chance to execute */
- Sleep( 2000 );
-
-
- /* check the results */
- for( i=0; i<NUM_HANDLERS; i++ )
- {
- if( i < finalHandler )
- {
- /* should not have been called */
- if( g_handlers[i].result )
- {
- Trace( "FAIL:Handler #%d was called but shouldn't "
- "have been\n",
- (i+1) );
- ret = FAIL;
- }
- }
- else
- {
- /* should have been called */
- if( ! g_handlers[i].result )
- {
- Trace( "FAIL:Handler #%d was not called\n", (i+1) );
- ret = FAIL;
- }
- }
- }
-
-
-
-done:
- /* unset any handlers that were set */
- for( i=0; i<NUM_HANDLERS; i++ )
- {
- if( g_handlers[i].set )
- {
- if( ! SetConsoleCtrlHandler( g_handlers[i].func, FALSE ) )
- {
- ret = FAIL;
- Trace( "ERROR:%lu:SetConsoleCtrlHandler() failed to add "
- "handler #%d\n",
- GetLastError(),
- (i+1) );
- }
- }
- }
-
-
- /* PAL termination */
- PAL_TerminateEx(ret);
-
-
- /* return our result */
- return ret;
-}
diff --git a/src/pal/tests/palsuite/threading/SetConsoleCtrlHandler/test5/testinfo.dat b/src/pal/tests/palsuite/threading/SetConsoleCtrlHandler/test5/testinfo.dat
deleted file mode 100644
index 1737394b55..0000000000
--- a/src/pal/tests/palsuite/threading/SetConsoleCtrlHandler/test5/testinfo.dat
+++ /dev/null
@@ -1,13 +0,0 @@
-#
-# Copyright (c) Microsoft Corporation. All rights reserved.
-#
-
-Version = 1.0
-Section = threading
-Function = SetConsoleCtrlHandler
-Name = Positive test for SetConsoleCtrlHandler
-TYPE = DEFAULT
-EXE1 = test5
-Description
-= Test to ensure proper operation of the SetConsoleCtrlHandler()
-= API by using it to chain multiple handler functions together.
diff --git a/src/pal/tests/palsuite/threading/SetConsoleCtrlHandler/test6/CMakeLists.txt b/src/pal/tests/palsuite/threading/SetConsoleCtrlHandler/test6/CMakeLists.txt
deleted file mode 100644
index 4e0c6ef3ab..0000000000
--- a/src/pal/tests/palsuite/threading/SetConsoleCtrlHandler/test6/CMakeLists.txt
+++ /dev/null
@@ -1,19 +0,0 @@
-cmake_minimum_required(VERSION 2.8.12.2)
-
-set(CMAKE_INCLUDE_CURRENT_DIR ON)
-
-set(SOURCES
- test6.c
-)
-
-add_executable(paltest_setconsolectrlhandler_test6
- ${SOURCES}
-)
-
-add_dependencies(paltest_setconsolectrlhandler_test6 coreclrpal)
-
-target_link_libraries(paltest_setconsolectrlhandler_test6
- pthread
- m
- coreclrpal
-)
diff --git a/src/pal/tests/palsuite/threading/SetConsoleCtrlHandler/test6/test6.c b/src/pal/tests/palsuite/threading/SetConsoleCtrlHandler/test6/test6.c
deleted file mode 100644
index ca232da772..0000000000
--- a/src/pal/tests/palsuite/threading/SetConsoleCtrlHandler/test6/test6.c
+++ /dev/null
@@ -1,172 +0,0 @@
-//
-// Copyright (c) Microsoft. All rights reserved.
-// Licensed under the MIT license. See LICENSE file in the project root for full license information.
-//
-
-/*=============================================================================
-**
-** Source: test6.c
-**
-** Dependencies: PAL_Initialize
-** PAL_Terminate
-** GenerateConsoleCtrlEvent
-**
-** Purpose:
-**
-** Test to ensure proper operation of the SetConsoleCtrlHandler()
-** API by trying to remove a non-existent handler.
-**
-
-**
-**===========================================================================*/
-#include <palsuite.h>
-
-
-static BOOL g_bFlag1 = FALSE;
-static BOOL g_bFlag2 = FALSE;
-
-
-/* first handler function */
-static BOOL PALAPI CtrlHandler1( DWORD CtrlType )
-{
- if( CtrlType == CTRL_C_EVENT )
- {
- g_bFlag1 = TRUE;
- return TRUE;
- }
-
- return FALSE;
-}
-
-
-/* second handler function */
-static BOOL PALAPI CtrlHandler2( DWORD CtrlType )
-{
- if( CtrlType == CTRL_C_EVENT )
- {
- g_bFlag2 = TRUE;
- return TRUE;
- }
-
- return FALSE;
-}
-
-
-
-
-
-/* main entry point function */
-int __cdecl main( int argc, char **argv )
-
-{
- /* local variables */
- BOOL ret = PASS;
-
-
- /* PAL initialization */
- if( (PAL_Initialize(argc, argv)) != 0 )
- {
- return( FAIL );
- }
-
-
- /* set the console control handler function */
- if( ! SetConsoleCtrlHandler( CtrlHandler1, TRUE ) )
- {
- ret = FAIL;
- Trace( "ERROR:%lu:SetConsoleCtrlHandler() failed to add "
- "CtrlHandler1\n",
- GetLastError() );
- Fail( "Test failed\n" );
- }
-
- /* test that the right control handler functions are set */
- if( ! GenerateConsoleCtrlEvent( CTRL_C_EVENT, 0 ) )
- {
- Trace( "ERROR:%lu:GenerateConsoleCtrlEvent() failed\n",
- GetLastError() );
- ret = FAIL;
- goto done;
- }
-
- /* give the handlers a chance to execute */
- Sleep( 2000 );
-
- /* check the results */
- if( g_bFlag2 )
- {
- Trace( "ERROR:CtrlHandler2() was inexplicably called\n" );
- ret = FAIL;
- goto done;
- }
-
- if( ! g_bFlag1 )
- {
- Trace( "ERROR:CtrlHandler1() was not called but should have been\n" );
- ret = FAIL;
- goto done;
- }
-
- /* reset our flags */
- g_bFlag1 = FALSE;
-
-
- /* try to unset CtrlHandler2, which isn't set in the first place */
- if( SetConsoleCtrlHandler( CtrlHandler2, FALSE ) )
- {
- ret = FAIL;
- Trace( "ERROR:SetConsoleCtrlHandler() succeeded trying to "
- "remove CtrlHandler2, which isn't set\n" );
- goto done;
- }
-
-
- /* make sure that the existing control handler functions are still set */
- if( ! GenerateConsoleCtrlEvent( CTRL_C_EVENT, 0 ) )
- {
- Trace( "ERROR:%lu:GenerateConsoleCtrlEvent() failed\n",
- GetLastError() );
- ret = FAIL;
- goto done;
- }
-
- /* give the handlers a chance to execute */
- Sleep( 2000 );
-
- /* check the results */
- if( g_bFlag2 )
- {
- Trace( "ERROR:CtrlHandler2() was inexplicably called\n" );
- ret = FAIL;
- goto done;
- }
-
- if( ! g_bFlag1 )
- {
- Trace( "ERROR:CtrlHandler1() was not called but should have been\n" );
- ret = FAIL;
- goto done;
- }
-
-
-
-done:
- /* unset any handlers that were set */
- if( ! SetConsoleCtrlHandler( CtrlHandler1, FALSE ) )
- {
- ret = FAIL;
- Trace( "ERROR:%lu:SetConsoleCtrlHandler() failed to "
- "remove CtrlHandler1\n",
- GetLastError() );
- Fail( "Test failed\n" );
- }
-
-
- /* PAL termination */
- PAL_TerminateEx(ret);
-
-
- /* return our result */
- return ret;
-}
-
diff --git a/src/pal/tests/palsuite/threading/SetConsoleCtrlHandler/test6/testinfo.dat b/src/pal/tests/palsuite/threading/SetConsoleCtrlHandler/test6/testinfo.dat
deleted file mode 100644
index 2a320a7a16..0000000000
--- a/src/pal/tests/palsuite/threading/SetConsoleCtrlHandler/test6/testinfo.dat
+++ /dev/null
@@ -1,13 +0,0 @@
-#
-# Copyright (c) Microsoft Corporation. All rights reserved.
-#
-
-Version = 1.0
-Section = threading
-Function = SetConsoleCtrlHandler
-Name = Negative test for SetConsoleCtrlHandler
-TYPE = DEFAULT
-EXE1 = test6
-Description
-= Test to ensure proper operation of the SetConsoleCtrlHandler()
-= API by trying to remove a non-existent handler.
diff --git a/src/pal/tests/palsuite/threading/SetConsoleCtrlHandler/test7/CMakeLists.txt b/src/pal/tests/palsuite/threading/SetConsoleCtrlHandler/test7/CMakeLists.txt
deleted file mode 100644
index 581785c136..0000000000
--- a/src/pal/tests/palsuite/threading/SetConsoleCtrlHandler/test7/CMakeLists.txt
+++ /dev/null
@@ -1,19 +0,0 @@
-cmake_minimum_required(VERSION 2.8.12.2)
-
-set(CMAKE_INCLUDE_CURRENT_DIR ON)
-
-set(SOURCES
- test7.c
-)
-
-add_executable(paltest_setconsolectrlhandler_test7
- ${SOURCES}
-)
-
-add_dependencies(paltest_setconsolectrlhandler_test7 coreclrpal)
-
-target_link_libraries(paltest_setconsolectrlhandler_test7
- pthread
- m
- coreclrpal
-)
diff --git a/src/pal/tests/palsuite/threading/SetConsoleCtrlHandler/test7/test7.c b/src/pal/tests/palsuite/threading/SetConsoleCtrlHandler/test7/test7.c
deleted file mode 100644
index eabfb19532..0000000000
--- a/src/pal/tests/palsuite/threading/SetConsoleCtrlHandler/test7/test7.c
+++ /dev/null
@@ -1,194 +0,0 @@
-//
-// Copyright (c) Microsoft. All rights reserved.
-// Licensed under the MIT license. See LICENSE file in the project root for full license information.
-//
-
-/*=============================================================================
-**
-** Source: test7.c
-**
-** Dependencies: PAL_Initialize
-** PAL_Terminate
-** GenerateConsoleCtrlEvent
-**
-** Purpose:
-**
-** Test to ensure proper operation of the SetConsoleCtrlHandler()
-** API by checking whether a console control handler function is
-** actually removed by the API when it returns success for that
-** operation.
-**
-
-**
-**===========================================================================*/
-#include <palsuite.h>
-
-
-static BOOL g_bFlag1 = FALSE;
-static BOOL g_bFlag2 = FALSE;
-
-
-/* first handler function */
-static BOOL PALAPI CtrlHandler1( DWORD CtrlType )
-{
- if( CtrlType == CTRL_C_EVENT )
- {
- g_bFlag1 = TRUE;
- return TRUE;
- }
-
- return FALSE;
-}
-
-
-/* second handler function */
-static BOOL PALAPI CtrlHandler2( DWORD CtrlType )
-{
- if( CtrlType == CTRL_C_EVENT )
- {
- g_bFlag2 = TRUE;
- return FALSE;
- }
-
- return FALSE;
-}
-
-
-
-
-
-/* main entry point function */
-int __cdecl main( int argc, char **argv )
-
-{
- /* local variables */
- BOOL ret = PASS;
- BOOL bSetHandler1 = FALSE;
-
-
- /* PAL initialization */
- if( (PAL_Initialize(argc, argv)) != 0 )
- {
- return( FAIL );
- }
-
-
- /* set the console control handler functions */
- if( SetConsoleCtrlHandler( CtrlHandler1, TRUE ) )
- {
- bSetHandler1 = TRUE;
- }
- else
- {
- ret = FAIL;
- Trace( "ERROR:%lu:SetConsoleCtrlHandler() failed to add "
- "CtrlHandler1\n",
- GetLastError() );
- Fail( "Test failed\n" );
- }
-
- if( ! SetConsoleCtrlHandler( CtrlHandler2, TRUE ) )
- {
- ret = FAIL;
- Trace( "ERROR:%lu:SetConsoleCtrlHandler() failed to add "
- "CtrlHandler2\n",
- GetLastError() );
- Fail( "Test failed\n" );
- }
-
-
- /* test that the right control handler functions are set */
- if( ! GenerateConsoleCtrlEvent( CTRL_C_EVENT, 0 ) )
- {
- Trace( "ERROR:%lu:GenerateConsoleCtrlEvent() failed\n",
- GetLastError() );
- ret = FAIL;
- goto done;
- }
-
- /* give the handlers a chance to execute */
- Sleep( 2000 );
-
- /* check the results */
- if( ! g_bFlag1 )
- {
- Trace( "ERROR:CtrlHandler1() was not called but should have been\n" );
- ret = FAIL;
- goto done;
- }
- if( ! g_bFlag2 )
- {
- Trace( "ERROR:CtrlHandler2() was not called but should have been\n" );
- ret = FAIL;
- goto done;
- }
-
-
- /* reset our flags */
- g_bFlag1 = FALSE;
- g_bFlag2 = FALSE;
-
-
- /* try to unset CtrlHandler2 */
- if( ! SetConsoleCtrlHandler( CtrlHandler2, FALSE ) )
- {
- ret = FAIL;
- Trace( "ERROR:%lu:SetConsoleCtrlHandler() failed to "
- "remove CtrlHandler2\n",
- GetLastError() );
- goto done;
- }
-
-
- /* make sure that CtrlHandler1 is set and CtrlHandler2 isn't */
- if( ! GenerateConsoleCtrlEvent( CTRL_C_EVENT, 0 ) )
- {
- Trace( "ERROR:%lu:GenerateConsoleCtrlEvent() failed\n",
- GetLastError() );
- ret = FAIL;
- goto done;
- }
-
- /* give the handlers a chance to execute */
- Sleep( 2000 );
-
- /* check the results */
- if( g_bFlag2 )
- {
- Trace( "ERROR:CtrlHandler2() was called after it was unset\n" );
- ret = FAIL;
- goto done;
- }
-
- if( ! g_bFlag1 )
- {
- Trace( "ERROR:CtrlHandler1() was not called but should have been\n" );
- ret = FAIL;
- goto done;
- }
-
-
-
-done:
- /* unset CtrlHandler1 if it was set */
- if( bSetHandler1 )
- {
- if( ! SetConsoleCtrlHandler( CtrlHandler1, FALSE ) )
- {
- ret = FAIL;
- Trace( "ERROR:%lu:SetConsoleCtrlHandler() failed to "
- "remove CtrlHandler1\n",
- GetLastError() );
- Fail( "Test failed\n" );
- }
- }
-
-
- /* PAL termination */
- PAL_TerminateEx(ret);
-
-
- /* return our result */
- return ret;
-}
-
diff --git a/src/pal/tests/palsuite/threading/SetConsoleCtrlHandler/test7/testinfo.dat b/src/pal/tests/palsuite/threading/SetConsoleCtrlHandler/test7/testinfo.dat
deleted file mode 100644
index 67bdb1c389..0000000000
--- a/src/pal/tests/palsuite/threading/SetConsoleCtrlHandler/test7/testinfo.dat
+++ /dev/null
@@ -1,15 +0,0 @@
-#
-# Copyright (c) Microsoft Corporation. All rights reserved.
-#
-
-Version = 1.0
-Section = threading
-Function = SetConsoleCtrlHandler
-Name = Positive test for SetConsoleCtrlHandler
-TYPE = DEFAULT
-EXE1 = test7
-Description
-= Test to ensure proper operation of the SetConsoleCtrlHandler()
-= API by checking whether a console control handler function is
-= actually removed by the API when it returns success for that
-= operation.
diff --git a/src/pal/tests/palsuite/threading/SetConsoleCtrlHandler/test8/CMakeLists.txt b/src/pal/tests/palsuite/threading/SetConsoleCtrlHandler/test8/CMakeLists.txt
deleted file mode 100644
index e7c093a75f..0000000000
--- a/src/pal/tests/palsuite/threading/SetConsoleCtrlHandler/test8/CMakeLists.txt
+++ /dev/null
@@ -1,19 +0,0 @@
-cmake_minimum_required(VERSION 2.8.12.2)
-
-set(CMAKE_INCLUDE_CURRENT_DIR ON)
-
-set(SOURCES
- test8.c
-)
-
-add_executable(paltest_setconsolectrlhandler_test8
- ${SOURCES}
-)
-
-add_dependencies(paltest_setconsolectrlhandler_test8 coreclrpal)
-
-target_link_libraries(paltest_setconsolectrlhandler_test8
- pthread
- m
- coreclrpal
-)
diff --git a/src/pal/tests/palsuite/threading/SetConsoleCtrlHandler/test8/test8.c b/src/pal/tests/palsuite/threading/SetConsoleCtrlHandler/test8/test8.c
deleted file mode 100644
index 1c3ee2b71d..0000000000
--- a/src/pal/tests/palsuite/threading/SetConsoleCtrlHandler/test8/test8.c
+++ /dev/null
@@ -1,192 +0,0 @@
-//
-// Copyright (c) Microsoft. All rights reserved.
-// Licensed under the MIT license. See LICENSE file in the project root for full license information.
-//
-
-/*=============================================================================
-**
-** Source: test8.c
-**
-** Dependencies: PAL_Initialize
-** PAL_Terminate
-** GenerateConsoleCtrlEvent
-**
-** Purpose:
-**
-** Test to ensure proper operation of the SetConsoleCtrlHandler()
-** API by attempting to add and remove the same handler multiple
-** times.
-**
-
-**
-**===========================================================================*/
-#include <palsuite.h>
-
-
-
-/* the number of times to set the console control handler function */
-#define HANDLER_SET_COUNT 5
-
-
-
-/* the number of times the console control handler function's been called */
-static int g_count = 0;
-
-
-
-
-/* to avoid having the default control handler abort our process */
-static BOOL PALAPI FinalCtrlHandler( DWORD CtrlType )
-{
- return (CtrlType == CTRL_C_EVENT);
-}
-
-
-/* test handler function */
-static BOOL PALAPI CtrlHandler1( DWORD CtrlType )
-{
- if( CtrlType == CTRL_C_EVENT )
- {
- ++g_count;
- }
-
- return FALSE;
-}
-
-
-
-
-
-/* main entry point function */
-int __cdecl main( int argc, char **argv )
-
-{
- /* local variables */
- int i;
- BOOL ret = PASS;
- BOOL bSetFinalHandler = FALSE;
- int nSetCount = 0;
-
-
- /* PAL initialization */
- if( (PAL_Initialize(argc, argv)) != 0 )
- {
- return( FAIL );
- }
-
-
- /* set our final console control handler function */
- if( SetConsoleCtrlHandler( FinalCtrlHandler, TRUE ) )
- {
- bSetFinalHandler = TRUE;
- }
- else
- {
- ret = FAIL;
- Trace( "ERROR:%lu:SetConsoleCtrlHandler() failed to add "
- "FinalCtrlHandler\n",
- GetLastError() );
- Fail( "Test failed\n" );
- }
-
- /* try to set our test handler multiple times */
- for( i=0; i<HANDLER_SET_COUNT; i++ )
- {
- if( SetConsoleCtrlHandler( CtrlHandler1, TRUE ) )
- {
- nSetCount++;
- }
- else
- {
- ret = FAIL;
- Trace( "ERROR:%lu:SetConsoleCtrlHandler() failed to add "
- "CtrlHandler1 at attempt #%d\n",
- GetLastError(),
- i );
- goto done;
- }
- }
-
- /* loop here -- generate an event and verify that our handler */
- /* was called the correct number of times, then unset it one */
- /* time and repeat until it's completely unset. */
- for( ; nSetCount>0; nSetCount-- )
- {
- /* test that the control handler functions are set */
- if( ! GenerateConsoleCtrlEvent( CTRL_C_EVENT, 0 ) )
- {
- Trace( "ERROR:%lu:GenerateConsoleCtrlEvent() failed\n",
- GetLastError() );
- ret = FAIL;
- goto done;
- }
-
- /* give the handlers a chance to execute */
- Sleep( 2000 );
-
- /* check the results */
- if( g_count != nSetCount )
- {
- Trace( "ERROR:CtrlHandler1() was not called %d times, "
- "expected %d\n",
- g_count,
- nSetCount );
- ret = FAIL;
- goto done;
- }
-
- /* unset the control handler one time */
- if( ! SetConsoleCtrlHandler( CtrlHandler1, FALSE ) )
- {
- ret = FAIL;
- Trace( "ERROR:%lu:SetConsoleCtrlHandler() failed to "
- "remove CtrlHandler instance #%d\n",
- GetLastError(),
- nSetCount );
- Fail( "Test failed\n" );
- }
-
- /* reset our counter */
- g_count = 0;
- }
-
-
-
-done:
- /* unset any lingering instances of our test control handler */
- for( ; nSetCount>0; nSetCount-- )
- {
- /* unset the control handler one time */
- if( ! SetConsoleCtrlHandler( CtrlHandler1, FALSE ) )
- {
- ret = FAIL;
- Trace( "ERROR:%lu:SetConsoleCtrlHandler() failed to "
- "remove CtrlHandler instance #%d\n",
- GetLastError(),
- nSetCount );
- Fail( "Test failed\n" );
- }
- }
-
-
- /* unset our final control handler if it was set */
- if( bSetFinalHandler )
- {
- if( ! SetConsoleCtrlHandler( FinalCtrlHandler, FALSE ) )
- {
- ret = FAIL;
- Trace( "ERROR:%lu:SetConsoleCtrlHandler() failed to "
- "remove FinalCtrlHandler\n",
- GetLastError() );
- Fail( "Test failed\n" );
- }
- }
-
-
- /* PAL termination */
- PAL_TerminateEx(ret);
-
-
- /* return our result */
- return ret;
-}
diff --git a/src/pal/tests/palsuite/threading/SetConsoleCtrlHandler/test8/testinfo.dat b/src/pal/tests/palsuite/threading/SetConsoleCtrlHandler/test8/testinfo.dat
deleted file mode 100644
index 7aaf38e2e9..0000000000
--- a/src/pal/tests/palsuite/threading/SetConsoleCtrlHandler/test8/testinfo.dat
+++ /dev/null
@@ -1,14 +0,0 @@
-#
-# Copyright (c) Microsoft Corporation. All rights reserved.
-#
-
-Version = 1.0
-Section = threading
-Function = SetConsoleCtrlHandler
-Name = Positive test for SetConsoleCtrlHandler
-TYPE = DEFAULT
-EXE1 = test8
-Description
-= Test to ensure proper operation of the SetConsoleCtrlHandler()
-= API by attempting to add and remove the same handler multiple
-= times.
diff --git a/src/pal/tests/palsuite/threading/WaitForMultipleObjects/CMakeLists.txt b/src/pal/tests/palsuite/threading/WaitForMultipleObjects/CMakeLists.txt
index ef14ea5352..f6aa0cb2d9 100644
--- a/src/pal/tests/palsuite/threading/WaitForMultipleObjects/CMakeLists.txt
+++ b/src/pal/tests/palsuite/threading/WaitForMultipleObjects/CMakeLists.txt
@@ -1,5 +1,4 @@
cmake_minimum_required(VERSION 2.8.12.2)
add_subdirectory(test1)
-add_subdirectory(test2)
diff --git a/src/pal/tests/palsuite/threading/WaitForMultipleObjects/test2/CMakeLists.txt b/src/pal/tests/palsuite/threading/WaitForMultipleObjects/test2/CMakeLists.txt
deleted file mode 100644
index e348bc519d..0000000000
--- a/src/pal/tests/palsuite/threading/WaitForMultipleObjects/test2/CMakeLists.txt
+++ /dev/null
@@ -1,19 +0,0 @@
-cmake_minimum_required(VERSION 2.8.12.2)
-
-set(CMAKE_INCLUDE_CURRENT_DIR ON)
-
-set(SOURCES
- test2.c
-)
-
-add_executable(paltest_waitformultipleobjects_test2
- ${SOURCES}
-)
-
-add_dependencies(paltest_waitformultipleobjects_test2 coreclrpal)
-
-target_link_libraries(paltest_waitformultipleobjects_test2
- pthread
- m
- coreclrpal
-)
diff --git a/src/pal/tests/palsuite/threading/WaitForMultipleObjects/test2/test2.c b/src/pal/tests/palsuite/threading/WaitForMultipleObjects/test2/test2.c
deleted file mode 100644
index 057df66a70..0000000000
--- a/src/pal/tests/palsuite/threading/WaitForMultipleObjects/test2/test2.c
+++ /dev/null
@@ -1,140 +0,0 @@
-//
-// Copyright (c) Microsoft. All rights reserved.
-// Licensed under the MIT license. See LICENSE file in the project root for full license information.
-//
-
-/*============================================================================
-**
-** Source: test1.c
-**
-** Purpose: Test to ensure that WaitForMultipleObjects() performs
-** as expected when called with an INFINITE timeout.
-**
-**
-**==========================================================================*/
-#include <palsuite.h>
-
-/* global data */
-static BOOL bEventSet = FALSE;
-static HANDLE hEvent = NULL;
-
-
-/* handler function */
-static BOOL PALAPI CtrlHandler( DWORD CtrlType )
-{
- if( CtrlType == CTRL_C_EVENT )
- {
- if( hEvent != NULL )
- {
- bEventSet = TRUE;
- if( ! SetEvent( hEvent ) )
- {
- Fail( "ERROR:%lu:SetEvent call failed", GetLastError() );
- }
- }
- return TRUE;
- }
-
- return FALSE;
-}
-
-
-/* main entry point function */
-int __cdecl main( int argc, char **argv )
-
-{
- /* local variables */
- BOOL ret = FAIL;
- DWORD dwRet;
-
-
- /* PAL initialization */
- if( (PAL_Initialize(argc, argv)) != 0 )
- {
- return( FAIL );
- }
-
-
- /* set the console control handler function */
- if( ! SetConsoleCtrlHandler( CtrlHandler, TRUE ) )
- {
- ret = FAIL;
- Trace( "ERROR:%lu:SetConsoleCtrlHandler() failed to add "
- "CtrlHandler\n",
- GetLastError() );
- goto done;
- }
-
-
- /* create a manual-reset event on which to wait */
- hEvent = CreateEvent( NULL, TRUE, FALSE, NULL );
- if( hEvent == NULL )
- {
- Trace( "ERROR:%lu:CreateEvent() call failed\n", GetLastError() );
- goto done;
- }
-
- /* helpful instructions */
- Trace( "This program is designed to test WaitForMultipleObjects using\n"
- "a timeout value of INFINITE, and consequently it's expected\n"
- "to run forever, waiting and waiting. Press CTRL-C when you feel\n"
- "you've sufficiently approximated infinity to end the test.\n" );
-
- /* wait on the event forever, until the user stops the program */
- dwRet = WaitForMultipleObjects( 1, &hEvent, TRUE, INFINITE );
- if( dwRet != WAIT_OBJECT_0 )
- {
- Trace( "ERROR:WaitForMultipleObjects returned %lu, "
- "expected WAIT_OBJECT_0\n",
- dwRet );
- goto done;
- }
-
- /* verify that the bEventSet flag has been set */
- if( ! bEventSet )
- {
- Trace( "ERROR:WaitForMultipleObjects returned WAIT_OBJECT_0 "
- "but the event was never set\n" );
- goto done;
- }
-
- /* success if we get here */
- ret = PASS;
-
-
-done:
- /* close our event handle */
- if( hEvent != NULL )
- {
- if( ! CloseHandle( hEvent ) )
- {
- Trace( "ERROR:%lu:CloseHandle call failed\n", GetLastError() );
- ret = FAIL;
- }
- }
-
- /* unset the control handle that was set */
- if( ! SetConsoleCtrlHandler( CtrlHandler, FALSE ) )
- {
- ret = FAIL;
- Trace( "ERROR:%lu:SetConsoleCtrlHandler() failed to "
- "remove CtrlHandler\n",
- GetLastError() );
- }
-
- /* check for failure */
- if( ret == FAIL )
- {
- Fail( "test failed\n" );
- }
-
-
- /* PAL termination */
- PAL_Terminate();
-
-
- /* return success */
- return PASS;
-}
-
-
diff --git a/src/pal/tests/palsuite/threading/WaitForMultipleObjects/test2/testinfo.dat b/src/pal/tests/palsuite/threading/WaitForMultipleObjects/test2/testinfo.dat
deleted file mode 100644
index ce80a8f5a1..0000000000
--- a/src/pal/tests/palsuite/threading/WaitForMultipleObjects/test2/testinfo.dat
+++ /dev/null
@@ -1,13 +0,0 @@
-#
-# Copyright (c) Microsoft Corporation. All rights reserved.
-#
-
-Version = 1.0
-Section = threading
-Function = WaitForMultipleObjects
-Name = Positive test for WaitForMultipleObjects
-TYPE = DEFAULT
-EXE1 = test2
-Description
-= Test to ensure that WaitForMultipleObjects() performs
-= as expected when called with an INFINITE timeout.