Plan 9 programs for controlling and checking the network: cs.c, csquery.c, netstat.c
[akaros.git] / tests / lock_test.c
index 7eaa691..8eb2310 100644 (file)
@@ -466,7 +466,7 @@ struct mcs_pdro_lock mcspdro_lock = MCSPDRO_LOCK_INIT;
 #define lock_func(lock_name, lock_cmd, unlock_cmd)                             \
 void *lock_name##_thread(void *arg)                                            \
 {                                                                              \
 #define lock_func(lock_name, lock_cmd, unlock_cmd)                             \
 void *lock_name##_thread(void *arg)                                            \
 {                                                                              \
-       int thread_id = (int)arg;                                                  \
+       long thread_id = (long)arg;                                                \
        int hold_time = ACCESS_ONCE(pargs.hold_time);                              \
        int delay_time = ACCESS_ONCE(pargs.delay_time);                            \
        int nr_loops = ACCESS_ONCE(pargs.nr_loops);                                \
        int hold_time = ACCESS_ONCE(pargs.hold_time);                              \
        int delay_time = ACCESS_ONCE(pargs.delay_time);                            \
        int nr_loops = ACCESS_ONCE(pargs.nr_loops);                                \
@@ -662,6 +662,7 @@ static void os_prep_work(int nr_threads)
        atomic_init(&preempt_cnt, 0);
        atomic_init(&indir_cnt, 0);
        pthread_can_vcore_request(FALSE);       /* 2LS won't manage vcores */
        atomic_init(&preempt_cnt, 0);
        atomic_init(&indir_cnt, 0);
        pthread_can_vcore_request(FALSE);       /* 2LS won't manage vcores */
+       pthread_need_tls(FALSE);
        pthread_lib_init();                                     /* gives us one vcore */
        ev_handlers[EV_VCORE_PREEMPT] = handle_preempt;
        ev_handlers[EV_CHECK_MSGS] = handle_indir;
        pthread_lib_init();                                     /* gives us one vcore */
        ev_handlers[EV_VCORE_PREEMPT] = handle_preempt;
        ev_handlers[EV_CHECK_MSGS] = handle_indir;
@@ -832,7 +833,7 @@ int main(int argc, char** argv)
         * already.  Want to read start before the threads pass their barrier */
        starttsc = read_tsc();
        /* create and join on yield */
         * already.  Want to read start before the threads pass their barrier */
        starttsc = read_tsc();
        /* create and join on yield */
-       for (int i = 0; i < nr_threads; i++) {
+       for (long i = 0; i < nr_threads; i++) {
                if (pthread_create(&worker_threads[i], NULL, pargs.lock_type,
                                   (void*)i))
                        perror("pth_create failed");
                if (pthread_create(&worker_threads[i], NULL, pargs.lock_type,
                                   (void*)i))
                        perror("pth_create failed");