Remove data. access from pthread_setaffinity_np (apple version)

pull/496/head
jsteube 8 years ago
parent dda89fe610
commit 9336ca8838

@ -7,6 +7,7 @@
#define _AFFINITY_H
#include <stdlib.h>
#include <stdarg.h>
#ifdef _POSIX
#include <pthread.h>

@ -170,9 +170,6 @@ char *strstatus (const uint threads_status);
void status ();
#ifdef _WIN
void fsync (int fd);
#endif
void myabort (void);
void myquit (void);

@ -3,6 +3,10 @@
* License.....: MIT
*/
#ifdef __APPLE__
#include <stdio.h>
#endif
#include "common.h"
#include "types_int.h"
#include "memory.h"
@ -14,19 +18,20 @@ static int pthread_setaffinity_np (pthread_t thread, size_t cpu_size, cpu_set_t
{
int core;
for (core = 0; core < (8 * (int)cpu_size); core++)
if (CPU_ISSET(core, cpu_set)) break;
for (core = 0; core < (8 * (int) cpu_size); core++)
{
if (CPU_ISSET (core, cpu_set)) break;
}
thread_affinity_policy_data_t policy = { core };
const int rc = thread_policy_set (pthread_mach_thread_np (thread), THREAD_AFFINITY_POLICY, (thread_policy_t) &policy, 1);
if (data.quiet == 0)
if (rc != KERN_SUCCESS)
{
if (rc != KERN_SUCCESS)
{
log_error ("ERROR: %s : %d", "thread_policy_set()", rc);
}
log_error ("ERROR: %s : %d", "thread_policy_set()", rc);
exit (-1);
}
return rc;

@ -41,7 +41,7 @@ extern hc_global_data_t data;
#ifdef WIN
void fsync (int fd)
static void fsync (int fd)
{
HANDLE h = (HANDLE) _get_osfhandle (fd);

Loading…
Cancel
Save