diff options
author | Xavier Leroy <xavier.leroy@inria.fr> | 1996-03-05 10:12:07 +0000 |
---|---|---|
committer | Xavier Leroy <xavier.leroy@inria.fr> | 1996-03-05 10:12:07 +0000 |
commit | ee63e8d356b5717a32b0739fbe957f8e92d6e2c1 (patch) | |
tree | 7db4dc36d7b0de780839840dc4d9ba89c65fd1ba /otherlibs/threads/scheduler.c | |
parent | 5e03e759464fed85e14b353fa9b015cc469291db (diff) |
Ajout de la fonction Thread.id
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@679 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
Diffstat (limited to 'otherlibs/threads/scheduler.c')
-rw-r--r-- | otherlibs/threads/scheduler.c | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/otherlibs/threads/scheduler.c b/otherlibs/threads/scheduler.c index c005970ed..be90f1972 100644 --- a/otherlibs/threads/scheduler.c +++ b/otherlibs/threads/scheduler.c @@ -176,9 +176,17 @@ value thread_new(clos) /* ML */ return (value) th; } +/* Return the thread identifier */ + +value thread_id(th) /* ML */ + value th; +{ + return ((struct thread_struct *)th)->ident; +} + /* Return the current time as a floating-point number */ -double timeofday() +static double timeofday() { struct timeval tv; gettimeofday(&tv, NULL); @@ -190,7 +198,7 @@ double timeofday() #define FOREACH_THREAD(x) x = curr_thread; do { x = x->next; #define END_FOREACH(x) } while (x != curr_thread) -void schedule_thread() +static void schedule_thread() { thread_t run_thread, th; fd_set readfds, writefds; |