Hi, At Wed, 14 Mar 2007 17:02:13 +0900, Lothar Scholz wrote in [ruby-core:10588]: > >> at the top of the file otherwise the "st_table* locals" will throw an > >> error if the extension has not included "st.h" before "node.h". > > NN> replace "st_table" with "struct st_table", and insert "struct > NN> st_table;" before the structure, I guess. > > No this doesn't help the problem is the line below. "VALUE thread;" > If i replace this with another identifier like "thread_" it doesn't > have any problems. Sorry, I couldn't understand the error messages in your second post. Although your compiler seems to be odd, "thread" is a too common name anyway. It should have been renamed as "rb_thread" or such when it'd been exposed, I guess.
Index: eval.c =================================================================== --- eval.c (revision 12059) +++ eval.c (working copy) @@ -244,6 +244,6 @@ static int scope_vmode; #define SCOPE_TEST(f) (scope_vmode&(f)) -VALUE (*ruby_sandbox_save)(struct thread *) = NULL; -VALUE (*ruby_sandbox_restore)(struct thread *) = NULL; +VALUE (*ruby_sandbox_save)(rb_thread_t) = NULL; +VALUE (*ruby_sandbox_restore)(rb_thread_t) = NULL; NODE* ruby_current_node; int ruby_safe_level = 0; @@ -9828,6 +9828,4 @@ extern VALUE rb_last_status; #endif -/* typedef struct thread * rb_thread_t; */ - #define THREAD_RAISED 0x200 /* temporary flag */ #define THREAD_TERMINATING 0x400 /* persistent flag */ @@ -9852,5 +9850,5 @@ struct thread_status_t { int safe; - enum thread_status status; + enum rb_thread_status status; int wait_for; int fd; @@ -9954,5 +9952,5 @@ rb_trap_eval(cmd, sig, safe) static const char * thread_status_name(status) - enum thread_status status; + enum rb_thread_status status; { switch (status) { @@ -11012,5 +11010,5 @@ rb_thread_join(th, limit) double limit; { - enum thread_status last_status = THREAD_RUNNABLE; + enum rb_thread_status last_status = THREAD_RUNNABLE; if (rb_thread_critical) rb_thread_deadlock(); @@ -11395,5 +11393,5 @@ VALUE rb_thread_stop() { - enum thread_status last_status = THREAD_RUNNABLE; + enum rb_thread_status last_status = THREAD_RUNNABLE; rb_thread_critical = 0; @@ -11659,5 +11657,5 @@ rb_thread_group(thread) #define THREAD_ALLOC(th) do {\ - th = ALLOC(struct thread);\ + th = ALLOC(struct rb_thread);\ \ th->next = 0;\ @@ -11824,5 +11822,5 @@ rb_thread_start_0(fn, arg, th) volatile VALUE thread = th->thread; struct BLOCK *volatile saved_block = 0; - enum thread_status status; + enum rb_thread_status status; int state; Index: node.h =================================================================== --- node.h (revision 12059) +++ node.h (working copy) @@ -391,5 +391,5 @@ typedef jmp_buf rb_jmpbuf_t; #endif -enum thread_status { +enum rb_thread_status { THREAD_TO_KILL, THREAD_RUNNABLE, @@ -398,8 +398,9 @@ enum thread_status { }; -typedef struct thread * rb_thread_t; +typedef struct rb_thread *rb_thread_t; +struct st_table; -struct thread { - struct thread *next, *prev; +struct rb_thread { + struct rb_thread *next, *prev; rb_jmpbuf_t context; #if (defined _WIN32 && !defined _WIN32_WCE) || defined __CYGWIN__ @@ -442,5 +443,5 @@ struct thread { int safe; - enum thread_status status; + enum rb_thread_status status; int wait_for; int fd; @@ -456,5 +457,5 @@ struct thread { VALUE thgroup; - st_table *locals; + struct st_table *locals; VALUE thread; @@ -463,6 +464,6 @@ struct thread { }; -extern VALUE (*ruby_sandbox_save)(struct thread *); -extern VALUE (*ruby_sandbox_restore)(struct thread *); +extern VALUE (*ruby_sandbox_save)(rb_thread_t); +extern VALUE (*ruby_sandbox_restore)(rb_thread_t); extern rb_thread_t curr_thread; extern rb_thread_t main_thread;
-- Nobu Nakada