perf_mmap__consume(&md->core);
 
                if (top->qe.rotate) {
-                       pthread_mutex_lock(&top->qe.mutex);
+                       mutex_lock(&top->qe.mutex);
                        top->qe.rotate = false;
-                       pthread_cond_signal(&top->qe.cond);
-                       pthread_mutex_unlock(&top->qe.mutex);
+                       cond_signal(&top->qe.cond);
+                       mutex_unlock(&top->qe.mutex);
                }
        }
 
 
                out = rotate_queues(top);
 
-               pthread_mutex_lock(&top->qe.mutex);
+               mutex_lock(&top->qe.mutex);
                top->qe.rotate = true;
-               pthread_cond_wait(&top->qe.cond, &top->qe.mutex);
-               pthread_mutex_unlock(&top->qe.mutex);
+               cond_wait(&top->qe.cond, &top->qe.mutex);
+               mutex_unlock(&top->qe.mutex);
 
                if (ordered_events__flush(out, OE_FLUSH__TOP))
                        pr_err("failed to process events\n");
        ordered_events__set_copy_on_queue(&top->qe.data[0], true);
        ordered_events__set_copy_on_queue(&top->qe.data[1], true);
        top->qe.in = &top->qe.data[0];
-       pthread_mutex_init(&top->qe.mutex, NULL);
-       pthread_cond_init(&top->qe.cond, NULL);
+       mutex_init(&top->qe.mutex);
+       cond_init(&top->qe.cond);
 }
 
 static int __cmd_top(struct perf_top *top)
 out_join:
        pthread_join(thread, NULL);
 out_join_thread:
-       pthread_cond_signal(&top->qe.cond);
+       cond_signal(&top->qe.cond);
        pthread_join(thread_process, NULL);
        return ret;
 }