summaryrefslogtreecommitdiff
path: root/rts/Schedule.c
diff options
context:
space:
mode:
authorErik de Castro Lopo <erikd@mega-nerd.com>2016-05-02 06:37:14 +1000
committerErik de Castro Lopo <erikd@mega-nerd.com>2016-05-05 08:29:27 +1000
commitdb9de7eb3e91820024f673bfdb6fb8064cfed20d (patch)
tree5e1c3ef0b6dee7f40fedbc118ba36cfe6ffdd1ee /rts/Schedule.c
parentad4392c142696d5092533480a82ed65322e9d413 (diff)
downloadhaskell-db9de7eb3e91820024f673bfdb6fb8064cfed20d.tar.gz
rts: Replace `nat` with `uint32_t`
The `nat` type was an alias for `unsigned int` with a comment saying it was at least 32 bits. We keep the typedef in case client code is using it but mark it as deprecated. Test Plan: Validated on Linux, OS X and Windows Reviewers: simonmar, austin, thomie, hvr, bgamari, hsyl20 Differential Revision: https://phabricator.haskell.org/D2166
Diffstat (limited to 'rts/Schedule.c')
-rw-r--r--rts/Schedule.c52
1 files changed, 26 insertions, 26 deletions
diff --git a/rts/Schedule.c b/rts/Schedule.c
index 3eb9624231..8bbc9cf3e2 100644
--- a/rts/Schedule.c
+++ b/rts/Schedule.c
@@ -123,9 +123,9 @@ static void scheduleYield (Capability **pcap, Task *task);
static rtsBool requestSync (Capability **pcap, Task *task,
PendingSync *sync_type, SyncType *prev_sync_type);
static void acquireAllCapabilities(Capability *cap, Task *task);
-static void releaseAllCapabilities(nat n, Capability *cap, Task *task);
-static void stopAllCapabilities(Capability **pCap, Task *task);
-static void startWorkerTasks (nat from USED_IF_THREADS, nat to USED_IF_THREADS);
+static void releaseAllCapabilities(uint32_t n, Capability *cap, Task *task);
+static void startWorkerTasks (uint32_t from USED_IF_THREADS,
+ uint32_t to USED_IF_THREADS);
#endif
static void scheduleStartSignalHandlers (Capability *cap);
static void scheduleCheckBlockedThreads (Capability *cap);
@@ -138,7 +138,7 @@ static void scheduleActivateSpark(Capability *cap);
static void schedulePostRunThread(Capability *cap, StgTSO *t);
static rtsBool scheduleHandleHeapOverflow( Capability *cap, StgTSO *t );
static rtsBool scheduleHandleYield( Capability *cap, StgTSO *t,
- nat prev_what_next );
+ uint32_t prev_what_next );
static void scheduleHandleThreadBlocked( StgTSO *t );
static rtsBool scheduleHandleThreadFinished( Capability *cap, Task *task,
StgTSO *t );
@@ -172,7 +172,7 @@ schedule (Capability *initialCapability, Task *task)
StgTSO *t;
Capability *cap;
StgThreadReturnCode ret;
- nat prev_what_next;
+ uint32_t prev_what_next;
rtsBool ready_to_gc;
#if defined(THREADED_RTS)
rtsBool first = rtsTrue;
@@ -423,7 +423,7 @@ run_thread:
case ACTIVITY_DONE_GC: {
// ACTIVITY_DONE_GC means we turned off the timer signal to
// conserve power (see #1623). Re-enable it here.
- nat prev;
+ uint32_t prev;
prev = xchg((P_)&recent_activity, ACTIVITY_YES);
if (prev == ACTIVITY_DONE_GC) {
#ifndef PROFILING
@@ -699,7 +699,7 @@ schedulePushWork(Capability *cap USED_IF_THREADS,
#if defined(THREADED_RTS)
Capability *free_caps[n_capabilities], *cap0;
- nat i, n_wanted_caps, n_free_caps;
+ uint32_t i, n_wanted_caps, n_free_caps;
StgTSO *t;
// migration can be turned off with +RTS -qm
@@ -1194,7 +1194,7 @@ scheduleHandleHeapOverflow( Capability *cap, StgTSO *t )
* -------------------------------------------------------------------------- */
static rtsBool
-scheduleHandleYield( Capability *cap, StgTSO *t, nat prev_what_next )
+scheduleHandleYield( Capability *cap, StgTSO *t, uint32_t prev_what_next )
{
/* put the thread back on the run queue. Then, if we're ready to
* GC, check whether this is the last task to stop. If so, wake
@@ -1459,7 +1459,7 @@ static rtsBool requestSync (
static void acquireAllCapabilities(Capability *cap, Task *task)
{
Capability *tmpcap;
- nat i;
+ uint32_t i;
ASSERT(pending_sync != NULL);
for (i=0; i < n_capabilities; i++) {
@@ -1491,9 +1491,9 @@ static void acquireAllCapabilities(Capability *cap, Task *task)
* -------------------------------------------------------------------------- */
#ifdef THREADED_RTS
-static void releaseAllCapabilities(nat n, Capability *cap, Task *task)
+static void releaseAllCapabilities(uint32_t n, Capability *cap, Task *task)
{
- nat i;
+ uint32_t i;
for (i = 0; i < n; i++) {
if (cap->no != i) {
@@ -1515,13 +1515,13 @@ scheduleDoGC (Capability **pcap, Task *task USED_IF_THREADS,
{
Capability *cap = *pcap;
rtsBool heap_census;
- nat collect_gen;
+ uint32_t collect_gen;
rtsBool major_gc;
#ifdef THREADED_RTS
- nat gc_type;
- nat i;
- nat need_idle;
- nat n_idle_caps = 0, n_failed_trygrab_idles = 0;
+ uint32_t gc_type;
+ uint32_t i;
+ uint32_t need_idle;
+ uint32_t n_idle_caps = 0, n_failed_trygrab_idles = 0;
StgTSO *tso;
rtsBool *idle_cap;
#endif
@@ -1593,7 +1593,7 @@ scheduleDoGC (Capability **pcap, Task *task USED_IF_THREADS,
// When using +RTS -qn, we need some capabilities to be idle during
// GC. The best bet is to choose some inactive ones, so we look for
// those first:
- nat n_idle = need_idle;
+ uint32_t n_idle = need_idle;
for (i=0; i < n_capabilities; i++) {
if (capabilities[i]->disabled) {
idle_cap[i] = rtsTrue;
@@ -1912,9 +1912,9 @@ forkProcess(HsStablePtr *entry
pid_t pid;
StgTSO* t,*next;
Capability *cap;
- nat g;
+ uint32_t g;
Task *task = NULL;
- nat i;
+ uint32_t i;
debugTrace(DEBUG_sched, "forking!");
@@ -2097,7 +2097,7 @@ forkProcess(HsStablePtr *entry
* ------------------------------------------------------------------------- */
void
-setNumCapabilities (nat new_n_capabilities USED_IF_THREADS)
+setNumCapabilities (uint32_t new_n_capabilities USED_IF_THREADS)
{
#if !defined(THREADED_RTS)
if (new_n_capabilities != 1) {
@@ -2112,9 +2112,9 @@ setNumCapabilities (nat new_n_capabilities USED_IF_THREADS)
#else
Task *task;
Capability *cap;
- nat n;
+ uint32_t n;
Capability *old_capabilities = NULL;
- nat old_n_capabilities = n_capabilities;
+ uint32_t old_n_capabilities = n_capabilities;
if (new_n_capabilities == enabled_capabilities) return;
@@ -2226,7 +2226,7 @@ deleteAllThreads ( Capability *cap )
// NOTE: only safe to call if we own all capabilities.
StgTSO* t, *next;
- nat g;
+ uint32_t g;
debugTrace(DEBUG_sched,"deleting all threads");
for (g = 0; g < RtsFlags.GcFlags.generations; g++) {
@@ -2530,10 +2530,10 @@ void scheduleWorker (Capability *cap, Task *task)
* -------------------------------------------------------------------------- */
static void
-startWorkerTasks (nat from USED_IF_THREADS, nat to USED_IF_THREADS)
+startWorkerTasks (uint32_t from USED_IF_THREADS, uint32_t to USED_IF_THREADS)
{
#if defined(THREADED_RTS)
- nat i;
+ uint32_t i;
Capability *cap;
for (i = from; i < to; i++) {
@@ -2624,7 +2624,7 @@ exitScheduler (rtsBool wait_foreign USED_IF_THREADS)
void
freeScheduler( void )
{
- nat still_running;
+ uint32_t still_running;
ACQUIRE_LOCK(&sched_mutex);
still_running = freeTaskManager();