pike.git/
src/
threads.c
Branch:
Tag:
Non-build tags
All tags
No tags
2000-02-06
2000-02-06 19:15:50 by Martin Stjernholm <mast@lysator.liu.se>
9a0d42a399bdbbff1f09482eb53d9695f1f70894 (
21
lines) (+
20
/-
1
)
[
Show
|
Annotate
]
Branch:
7.9
Added _sprintf() and id() to the thread_id class.
Rev: src/threads.c:1.108
1:
#include "global.h"
-
RCSID("$Id: threads.c,v 1.
107
2000/
01
/
16
05
:
57
:
34
hubbe
Exp $");
+
RCSID("$Id: threads.c,v 1.
108
2000/
02
/
06
19
:
15
:
50
mast
Exp $");
int num_threads = 1; int threads_disabled = 0;
19:
#include "main.h" #include "module_support.h" #include "pike_types.h"
+
#include "operators.h"
#include <errno.h>
1001:
push_int(THIS_THREAD->status); }
+
void f_thread_id_id(INT32 args)
+
{
+
pop_n_elems(args);
+
push_int(THIS_THREAD->id);
+
}
+
+
void f_thread_id__sprintf (INT32 args)
+
{
+
pop_n_elems (args);
+
push_constant_text ("Thread.Thread(");
+
push_int (THIS_THREAD->id);
+
push_constant_text (")");
+
f_add (3);
+
}
+
static void f_thread_id_result(INT32 args) { struct thread_state *th=THIS_THREAD;
1236:
ADD_FUNCTION("wait",f_thread_id_result,tFunc(tNone,tMix),0); /* function(:int) */ ADD_FUNCTION("status",f_thread_id_status,tFunc(tNone,tInt),0);
+
ADD_FUNCTION("id",f_thread_id_id,tFunc(tNone,tInt),0);
+
ADD_FUNCTION("_sprintf",f_thread_id__sprintf,tFunc(tNone,tStr),0);
set_gc_mark_callback(thread_was_marked); set_gc_check_callback(thread_was_checked); set_init_callback(init_thread_obj);