Add SIGPROF based pvcalarms to pthreads
[akaros.git] / user / pthread / profalarm.c
1 /* Copyright (c) 2014 The Regents of the University of California
2  * Kevin Klues <klueska@cs.berkeley.edu>
3  * See LICENSE for details. */
4
5 #include <pthread.h>
6 #include <pvcalarm.h>
7
8 void pvcalarm_callback()
9 {
10         if (current_uthread)
11                 pthread_kill((pthread_t)current_uthread, SIGPROF);
12 }
13
14 void enable_profalarm(uint64_t usecs)
15 {
16         enable_pvcalarms(PVCALARM_PROF, usecs, pvcalarm_callback);
17 }
18
19 void disable_profalarm()
20 {
21         disable_pvcalarms();
22 }