summaryrefslogtreecommitdiff
path: root/rts/win32
diff options
context:
space:
mode:
authorBen Gamari <bgamari.foss@gmail.com>2016-11-29 16:51:30 -0500
committerBen Gamari <ben@smart-cactus.org>2016-11-29 16:51:30 -0500
commit428e152be6bb0fd3867e41cee82a6d5968a11a26 (patch)
treee43d217c10c052704f872cd7e1df4d335c12d376 /rts/win32
parent56d74515396c8b6360ba7898cbc4b68f0f1fb2ea (diff)
downloadhaskell-428e152be6bb0fd3867e41cee82a6d5968a11a26.tar.gz
Use C99's bool
Test Plan: Validate on lots of platforms Reviewers: erikd, simonmar, austin Reviewed By: erikd, simonmar Subscribers: michalt, thomie Differential Revision: https://phabricator.haskell.org/D2699
Diffstat (limited to 'rts/win32')
-rw-r--r--rts/win32/AsyncIO.c6
-rw-r--r--rts/win32/AsyncIO.h4
-rw-r--r--rts/win32/AwaitEvent.c2
-rw-r--r--rts/win32/ConsoleHandler.c28
-rw-r--r--rts/win32/ConsoleHandler.h2
-rw-r--r--rts/win32/IOManager.c22
-rw-r--r--rts/win32/IOManager.h2
-rw-r--r--rts/win32/OSMem.c4
-rw-r--r--rts/win32/OSThreads.c16
-rw-r--r--rts/win32/ThrIOManager.c4
-rw-r--r--rts/win32/Ticker.c2
-rw-r--r--rts/win32/WorkQueue.c30
12 files changed, 61 insertions, 61 deletions
diff --git a/rts/win32/AsyncIO.c b/rts/win32/AsyncIO.c
index 887f642fdd..6a05f680db 100644
--- a/rts/win32/AsyncIO.c
+++ b/rts/win32/AsyncIO.c
@@ -181,7 +181,7 @@ startupAsyncIO()
}
void
-shutdownAsyncIO(rtsBool wait_threads)
+shutdownAsyncIO(bool wait_threads)
{
ShutdownIOManager(wait_threads);
if (completed_req_event != INVALID_HANDLE_VALUE) {
@@ -216,7 +216,7 @@ shutdownAsyncIO(rtsBool wait_threads)
* to complete if the 'completedTable' is empty.
*/
int
-awaitRequests(rtsBool wait)
+awaitRequests(bool wait)
{
#ifndef THREADED_RTS
// none of this is actually used in the threaded RTS
@@ -231,7 +231,7 @@ start:
// Nothing immediately available & we won't wait
if ((!wait && completed_hw == 0)
#if 0
- // If we just return when wait==rtsFalse, we'll go into a busy
+ // If we just return when wait==false, we'll go into a busy
// wait loop, so I disabled this condition --SDM 18/12/2003
(issued_reqs == 0 && completed_hw == 0)
#endif
diff --git a/rts/win32/AsyncIO.h b/rts/win32/AsyncIO.h
index 67d5110a47..bedbf5b67b 100644
--- a/rts/win32/AsyncIO.h
+++ b/rts/win32/AsyncIO.h
@@ -17,9 +17,9 @@ addIORequest(int fd,
extern unsigned int addDelayRequest(int usecs);
extern unsigned int addDoProcRequest(void* proc, void* param);
extern int startupAsyncIO(void);
-extern void shutdownAsyncIO(rtsBool wait_threads);
+extern void shutdownAsyncIO(bool wait_threads);
-extern int awaitRequests(rtsBool wait);
+extern int awaitRequests(bool wait);
extern void abandonRequestWait(void);
extern void resetAbandonRequestWait(void);
diff --git a/rts/win32/AwaitEvent.c b/rts/win32/AwaitEvent.c
index 51581025e1..b639121c87 100644
--- a/rts/win32/AwaitEvent.c
+++ b/rts/win32/AwaitEvent.c
@@ -25,7 +25,7 @@
static uint32_t workerWaitingForRequests = 0;
void
-awaitEvent(rtsBool wait)
+awaitEvent(bool wait)
{
do {
/* Try to de-queue completed IO requests
diff --git a/rts/win32/ConsoleHandler.c b/rts/win32/ConsoleHandler.c
index 4bcbe1201b..d30fd81e67 100644
--- a/rts/win32/ConsoleHandler.c
+++ b/rts/win32/ConsoleHandler.c
@@ -15,7 +15,7 @@ extern int stg_InstallConsoleEvent(int action, StgStablePtr *handler);
static BOOL WINAPI shutdown_handler(DWORD dwCtrlType);
static BOOL WINAPI generic_handler(DWORD dwCtrlType);
-static rtsBool deliver_event = rtsTrue;
+static bool deliver_event = true;
StgInt console_handler = STG_SIG_DFL;
#if !defined(THREADED_RTS)
@@ -83,7 +83,7 @@ static BOOL WINAPI shutdown_handler(DWORD dwCtrlType)
case CTRL_CLOSE_EVENT:
/* see generic_handler() comment re: this event */
- return FALSE;
+ return false;
case CTRL_C_EVENT:
case CTRL_BREAK_EVENT:
@@ -95,11 +95,11 @@ static BOOL WINAPI shutdown_handler(DWORD dwCtrlType)
} else {
interruptStgRts();
}
- return TRUE;
+ return true;
/* shutdown + logoff events are not handled here. */
default:
- return FALSE;
+ return false;
}
}
@@ -112,14 +112,14 @@ static BOOL WINAPI shutdown_handler(DWORD dwCtrlType)
*/
void initDefaultHandlers(void)
{
- if ( !SetConsoleCtrlHandler(shutdown_handler, TRUE) ) {
+ if ( !SetConsoleCtrlHandler(shutdown_handler, true) ) {
errorBelch("warning: failed to install default console handler");
}
}
void resetDefaultHandlers(void)
{
- if ( !SetConsoleCtrlHandler(shutdown_handler, FALSE) ) {
+ if ( !SetConsoleCtrlHandler(shutdown_handler, false) ) {
errorBelch("warning: failed to uninstall default console handler");
}
}
@@ -135,7 +135,7 @@ void resetDefaultHandlers(void)
void
blockUserSignals(void)
{
- deliver_event = rtsFalse;
+ deliver_event = false;
}
@@ -147,7 +147,7 @@ blockUserSignals(void)
void
unblockUserSignals(void)
{
- deliver_event = rtsTrue;
+ deliver_event = true;
}
@@ -227,9 +227,9 @@ static BOOL WINAPI generic_handler(DWORD dwCtrlType)
* the user of the app will be unable to kill/close it. Not
* good, so disable the delivery for now.
*/
- return FALSE;
+ return false;
default:
- if (!deliver_event) return TRUE;
+ if (!deliver_event) return true;
#if defined(THREADED_RTS)
sendIOManagerEvent((StgWord8) ((dwCtrlType<<1) | 1));
@@ -242,7 +242,7 @@ static BOOL WINAPI generic_handler(DWORD dwCtrlType)
// we need to wake up awaitEvent()
abandonRequestWait();
#endif
- return TRUE;
+ return true;
}
}
@@ -260,13 +260,13 @@ rts_InstallConsoleEvent(int action, StgStablePtr *handler)
switch (action) {
case STG_SIG_IGN:
console_handler = STG_SIG_IGN;
- if ( !SetConsoleCtrlHandler(NULL, TRUE) ) {
+ if ( !SetConsoleCtrlHandler(NULL, true) ) {
errorBelch("warning: unable to ignore console events");
}
break;
case STG_SIG_DFL:
console_handler = STG_SIG_IGN;
- if ( !SetConsoleCtrlHandler(NULL, FALSE) ) {
+ if ( !SetConsoleCtrlHandler(NULL, false) ) {
errorBelch("warning: unable to restore default console event "
"handling");
}
@@ -280,7 +280,7 @@ rts_InstallConsoleEvent(int action, StgStablePtr *handler)
#endif
if (previous_hdlr < 0 || previous_hdlr == STG_SIG_HAN) {
/* Only install generic_handler() once */
- if ( !SetConsoleCtrlHandler(generic_handler, TRUE) ) {
+ if ( !SetConsoleCtrlHandler(generic_handler, true) ) {
errorBelch("warning: unable to install console event handler");
}
}
diff --git a/rts/win32/ConsoleHandler.h b/rts/win32/ConsoleHandler.h
index 0d09a67b94..cd4a5447da 100644
--- a/rts/win32/ConsoleHandler.h
+++ b/rts/win32/ConsoleHandler.h
@@ -41,7 +41,7 @@ extern StgInt stg_pending_events;
* runnable. A console handler is used to handle termination events (Ctrl+C)
* and isn't considered a 'user handler'.
*/
-#define anyUserHandlers() (rtsFalse)
+#define anyUserHandlers() (false)
/*
* Function: startSignalHandlers()
diff --git a/rts/win32/IOManager.c b/rts/win32/IOManager.c
index e4f575c394..f25b006c4d 100644
--- a/rts/win32/IOManager.c
+++ b/rts/win32/IOManager.c
@@ -81,7 +81,7 @@ IOWorkerProc(PVOID param)
* be above some threshold.
*
*/
- rc = WaitForMultipleObjects( 2, hWaits, FALSE, INFINITE );
+ rc = WaitForMultipleObjects( 2, hWaits, false, INFINITE );
if (rc == WAIT_OBJECT_0) {
// we received the exit event
@@ -307,30 +307,30 @@ StartIOManager(void)
mmresult = timeGetDevCaps(&timecaps, sizeof(timecaps));
if (mmresult != MMSYSERR_NOERROR) {
- return FALSE;
+ return false;
}
sleepResolution = timecaps.wPeriodMin;
mmresult = timeBeginPeriod(sleepResolution);
if (mmresult != MMSYSERR_NOERROR) {
- return FALSE;
+ return false;
}
wq = NewWorkQueue();
- if ( !wq ) return FALSE;
+ if ( !wq ) return false;
ioMan = (IOManagerState*)malloc(sizeof(IOManagerState));
if (!ioMan) {
FreeWorkQueue(wq);
- return FALSE;
+ return false;
}
/* A manual-reset event */
- hExit = CreateEvent ( NULL, TRUE, FALSE, NULL );
+ hExit = CreateEvent ( NULL, true, false, NULL );
if ( !hExit ) {
FreeWorkQueue(wq);
free(ioMan);
- return FALSE;
+ return false;
}
ioMan->hExitEvent = hExit;
@@ -344,7 +344,7 @@ StartIOManager(void)
ioMan->active_work_items = NULL;
ioMan->sleepResolution = sleepResolution;
- return TRUE;
+ return true;
}
/*
@@ -466,7 +466,7 @@ AddDelayRequest ( unsigned int usecs,
{
WorkItem* wItem = (WorkItem*)malloc(sizeof(WorkItem));
unsigned int reqID;
- if (!ioMan || !wItem) return FALSE;
+ if (!ioMan || !wItem) return false;
reqID = ioMan->requestID++;
/* Fill in the blanks */
@@ -491,7 +491,7 @@ AddProcRequest ( void* proc,
{
WorkItem* wItem = (WorkItem*)malloc(sizeof(WorkItem));
unsigned int reqID;
- if (!ioMan || !wItem) return FALSE;
+ if (!ioMan || !wItem) return false;
reqID = ioMan->requestID++;
/* Fill in the blanks */
@@ -506,7 +506,7 @@ AddProcRequest ( void* proc,
return depositWorkItem(reqID, wItem);
}
-void ShutdownIOManager ( rtsBool wait_threads )
+void ShutdownIOManager ( bool wait_threads )
{
int num;
MMRESULT mmresult;
diff --git a/rts/win32/IOManager.h b/rts/win32/IOManager.h
index 30fad49c94..94821a8475 100644
--- a/rts/win32/IOManager.h
+++ b/rts/win32/IOManager.h
@@ -81,7 +81,7 @@ extern CompletionProc onComplete;
* Starting up and shutting down.
*/
extern BOOL StartIOManager ( void );
-extern void ShutdownIOManager ( rtsBool wait_threads );
+extern void ShutdownIOManager ( bool wait_threads );
/*
* Adding I/O and delay requests. With each request a
diff --git a/rts/win32/OSMem.c b/rts/win32/OSMem.c
index b43636c198..b6b97a7199 100644
--- a/rts/win32/OSMem.c
+++ b/rts/win32/OSMem.c
@@ -428,7 +428,7 @@ StgWord64 getPhysicalMemorySize (void)
return physMemSize;
}
-void setExecutable (void *p, W_ len, rtsBool exec)
+void setExecutable (void *p, W_ len, bool exec)
{
DWORD dwOldProtect = 0;
if (VirtualProtect (p, len,
@@ -499,7 +499,7 @@ void osReleaseHeapMemory (void)
#endif
-rtsBool osNumaAvailable(void)
+bool osNumaAvailable(void)
{
return osNumaNodes() > 1;
}
diff --git a/rts/win32/OSThreads.c b/rts/win32/OSThreads.c
index b36c3e53da..652ba13b4f 100644
--- a/rts/win32/OSThreads.c
+++ b/rts/win32/OSThreads.c
@@ -63,31 +63,31 @@ closeCondition( Condition* pCond )
return;
}
-rtsBool
+bool
broadcastCondition ( Condition* pCond )
{
PulseEvent(*pCond);
- return rtsTrue;
+ return true;
}
-rtsBool
+bool
signalCondition ( Condition* pCond )
{
if (SetEvent(*pCond) == 0) {
sysErrorBelch("SetEvent");
stg_exit(EXIT_FAILURE);
}
- return rtsTrue;
+ return true;
}
-rtsBool
+bool
waitCondition ( Condition* pCond, Mutex* pMut )
{
RELEASE_LOCK(pMut);
WaitForSingleObject(*pCond, INFINITE);
/* Hmm..use WaitForMultipleObjects() ? */
ACQUIRE_LOCK(pMut);
- return rtsTrue;
+ return true;
}
void
@@ -133,7 +133,7 @@ osThreadId()
return GetCurrentThreadId();
}
-rtsBool
+bool
osThreadIsAlive(OSThreadId id)
{
DWORD exit_code;
@@ -166,7 +166,7 @@ void
initMutex (Mutex* pMut)
{
HANDLE h = CreateMutex ( NULL, /* default sec. attributes */
- FALSE, /* not owned => initially signalled */
+ TRUE, /* not owned => initially signalled */
NULL
);
*pMut = h;
diff --git a/rts/win32/ThrIOManager.c b/rts/win32/ThrIOManager.c
index 0fb5912024..56042ddc77 100644
--- a/rts/win32/ThrIOManager.c
+++ b/rts/win32/ThrIOManager.c
@@ -43,8 +43,8 @@ getIOManagerEvent (void)
if (io_manager_event == INVALID_HANDLE_VALUE) {
hRes = CreateEvent ( NULL, // no security attrs
- TRUE, // manual reset
- FALSE, // initial state,
+ true, // manual reset
+ false, // initial state,
NULL ); // event name: NULL for private events
if (hRes == NULL) {
sysErrorBelch("getIOManagerEvent");
diff --git a/rts/win32/Ticker.c b/rts/win32/Ticker.c
index dd04d84118..7bc5ed55e3 100644
--- a/rts/win32/Ticker.c
+++ b/rts/win32/Ticker.c
@@ -71,7 +71,7 @@ stopTicker(void)
}
void
-exitTicker (rtsBool wait)
+exitTicker (bool wait)
{
if (timer_queue != NULL) {
DeleteTimerQueueEx(timer_queue, wait ? INVALID_HANDLE_VALUE : NULL);
diff --git a/rts/win32/WorkQueue.c b/rts/win32/WorkQueue.c
index a995f45f6d..562d04859c 100644
--- a/rts/win32/WorkQueue.c
+++ b/rts/win32/WorkQueue.c
@@ -99,7 +99,7 @@ GetWorkQueueHandle ( WorkQueue* pq )
* Function: GetWork
*
* Fetch a work item from the queue, blocking if none available.
- * Return value indicates of FALSE indicates error/fatal condition.
+ * Return value indicates of false indicates error/fatal condition.
*/
BOOL
GetWork ( WorkQueue* pq, void** ppw )
@@ -108,11 +108,11 @@ GetWork ( WorkQueue* pq, void** ppw )
if (!pq) {
queue_error("GetWork", "NULL WorkQueue object");
- return FALSE;
+ return false;
}
if (!ppw) {
queue_error("GetWork", "NULL WorkItem object");
- return FALSE;
+ return false;
}
/* Block waiting for work item to become available */
@@ -120,7 +120,7 @@ GetWork ( WorkQueue* pq, void** ppw )
!= WAIT_OBJECT_0 ) {
queue_error_rc("GetWork.WaitForSingleObject(workAvailable)",
( (WAIT_FAILED == rc) ? GetLastError() : rc));
- return FALSE;
+ return false;
}
return FetchWork(pq,ppw);
@@ -130,7 +130,7 @@ GetWork ( WorkQueue* pq, void** ppw )
* Function: FetchWork
*
* Fetch a work item from the queue, blocking if none available.
- * Return value indicates of FALSE indicates error/fatal condition.
+ * Return value indicates of false indicates error/fatal condition.
*/
BOOL
FetchWork ( WorkQueue* pq, void** ppw )
@@ -139,11 +139,11 @@ FetchWork ( WorkQueue* pq, void** ppw )
if (!pq) {
queue_error("FetchWork", "NULL WorkQueue object");
- return FALSE;
+ return false;
}
if (!ppw) {
queue_error("FetchWork", "NULL WorkItem object");
- return FALSE;
+ return false;
}
EnterCriticalSection(&pq->queueLock);
@@ -155,17 +155,17 @@ FetchWork ( WorkQueue* pq, void** ppw )
LeaveCriticalSection(&pq->queueLock);
if ( 0 == rc ) {
queue_error_rc("FetchWork.ReleaseSemaphore()", GetLastError());
- return FALSE;
+ return false;
}
- return TRUE;
+ return true;
}
/*
* Function: SubmitWork
*
* Add work item to the queue, blocking if no room available.
- * Return value indicates of FALSE indicates error/fatal condition.
+ * Return value indicates of false indicates error/fatal condition.
*/
BOOL
SubmitWork ( WorkQueue* pq, void* pw )
@@ -174,11 +174,11 @@ SubmitWork ( WorkQueue* pq, void* pw )
if (!pq) {
queue_error("SubmitWork", "NULL WorkQueue object");
- return FALSE;
+ return false;
}
if (!pw) {
queue_error("SubmitWork", "NULL WorkItem object");
- return FALSE;
+ return false;
}
/* Block waiting for work item to become available */
@@ -187,7 +187,7 @@ SubmitWork ( WorkQueue* pq, void* pw )
queue_error_rc("SubmitWork.WaitForSingleObject(workAvailable)",
( (WAIT_FAILED == rc) ? GetLastError() : rc));
- return FALSE;
+ return false;
}
EnterCriticalSection(&pq->queueLock);
@@ -197,10 +197,10 @@ SubmitWork ( WorkQueue* pq, void* pw )
LeaveCriticalSection(&pq->queueLock);
if ( 0 == rc ) {
queue_error_rc("SubmitWork.ReleaseSemaphore()", GetLastError());
- return FALSE;
+ return false;
}
- return TRUE;
+ return true;
}
/* Error handling */