summaryrefslogtreecommitdiff
path: root/rts/posix/OSThreads.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/posix/OSThreads.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/posix/OSThreads.c')
-rw-r--r--rts/posix/OSThreads.c28
1 files changed, 14 insertions, 14 deletions
diff --git a/rts/posix/OSThreads.c b/rts/posix/OSThreads.c
index 1562ee49d7..ad138d314d 100644
--- a/rts/posix/OSThreads.c
+++ b/rts/posix/OSThreads.c
@@ -227,10 +227,10 @@ forkOS_createThread ( HsStablePtr entry )
return result;
}
-nat
+uint32_t
getNumberOfProcessors (void)
{
- static nat nproc = 0;
+ static uint32_t nproc = 0;
if (nproc == 0) {
#if defined(HAVE_SYSCONF) && defined(_SC_NPROCESSORS_ONLN)
@@ -238,13 +238,13 @@ getNumberOfProcessors (void)
#elif defined(HAVE_SYSCONF) && defined(_SC_NPROCESSORS_CONF)
nproc = sysconf(_SC_NPROCESSORS_CONF);
#elif defined(darwin_HOST_OS)
- size_t size = sizeof(nat);
+ size_t size = sizeof(uint32_t);
if(sysctlbyname("hw.logicalcpu",&nproc,&size,NULL,0) != 0) {
if(sysctlbyname("hw.ncpu",&nproc,&size,NULL,0) != 0)
nproc = 1;
}
#elif defined(freebsd_HOST_OS)
- size_t size = sizeof(nat);
+ size_t size = sizeof(uint32_t);
if(sysctlbyname("hw.ncpu",&nproc,&size,NULL,0) != 0)
nproc = 1;
#else
@@ -260,11 +260,11 @@ getNumberOfProcessors (void)
// number of physical CPUs, in which case, the thread will be allowed
// to run on CPU n, n+m, n+2m etc.
void
-setThreadAffinity (nat n, nat m)
+setThreadAffinity (uint32_t n, uint32_t m)
{
- nat nproc;
+ uint32_t nproc;
cpu_set_t cs;
- nat i;
+ uint32_t i;
nproc = getNumberOfProcessors();
CPU_ZERO(&cs);
@@ -277,7 +277,7 @@ setThreadAffinity (nat n, nat m)
#elif defined(darwin_HOST_OS) && defined(THREAD_AFFINITY_POLICY)
// Schedules the current thread in the affinity set identified by tag n.
void
-setThreadAffinity (nat n, nat m GNUC3_ATTRIBUTE(__unused__))
+setThreadAffinity (uint32_t n, uint32_t m GNUC3_ATTRIBUTE(__unused__))
{
thread_affinity_policy_data_t policy;
@@ -290,11 +290,11 @@ setThreadAffinity (nat n, nat m GNUC3_ATTRIBUTE(__unused__))
#elif defined(HAVE_SYS_CPUSET_H) /* FreeBSD 7.1+ */
void
-setThreadAffinity(nat n, nat m)
+setThreadAffinity(uint32_t n, uint32_t m)
{
- nat nproc;
+ uint32_t nproc;
cpuset_t cs;
- nat i;
+ uint32_t i;
nproc = getNumberOfProcessors();
CPU_ZERO(&cs);
@@ -308,8 +308,8 @@ setThreadAffinity(nat n, nat m)
#else
void
-setThreadAffinity (nat n GNUC3_ATTRIBUTE(__unused__),
- nat m GNUC3_ATTRIBUTE(__unused__))
+setThreadAffinity (uint32_t n GNUC3_ATTRIBUTE(__unused__),
+ uint32_t m GNUC3_ATTRIBUTE(__unused__))
{
}
#endif
@@ -328,7 +328,7 @@ forkOS_createThread ( HsStablePtr entry STG_UNUSED )
return -1;
}
-nat getNumberOfProcessors (void)
+uint32_t getNumberOfProcessors (void)
{
return 1;
}