Browse Source

Make shure threads will run on the same core as the calling thread

suites/jessie
nextime 6 years ago
parent
commit
8870b0112f
2 changed files with 2 additions and 2 deletions
  1. +1
    -1
      dotprod_mutex.c
  2. +1
    -1
      pinthread.c

+ 1
- 1
dotprod_mutex.c View File

@@ -33,7 +33,7 @@ typedef struct

/* Define globally accessible variables and a mutex */

#define NUMTHRDS 2
#define NUMTHRDS 10
#define VECLEN 100000
DOTDATA dotstr;
pthread_t callThd[NUMTHRDS];


+ 1
- 1
pinthread.c View File

@@ -43,7 +43,7 @@ int pthread_create(pthread_t *thread,
int ret;
cpu_set_t mask; /* Define your cpu_set bit mask. */
CPU_ZERO(&mask); /* Initialize it all to 0, i.e. no CPUs selected. */
CPU_SET(0, &mask); /* set the bit that represents core 0. */
CPU_SET(sched_getcpu(), &mask); /* set the bit that represents core 0. */

//targs.arg = arg;
//targs.fn = start_routine;


Loading…
Cancel
Save