Solaris 64bit mode: crash in longjmp()

Claus Assmann <[email protected]> Thu, 4 Dec 2003 20:10:44 -0800
Newsgroups gmane.comp.lib.state-threads.devel
Message-ID <[email protected]>
[forwarded from st-users with more information]

Has anyone succeeded compiling and using statethreads in 64bit mode
on Solaris (8 or 9, using gcc or Sun's C compiler)?  A simple program
crashes in longjmp():

#0  0xffffffff7ec3b8e8 in longjmp () from /usr/lib/64/libc.so.1
#1  0x00000001000035a0 in _st_vp_schedule () at sched.c:165
#2  0x0000000100004e88 in st_usleep (usecs=4294987380) at sync.c:113
#3  0x0000000100002b48 in main (argc=16777217, argv=0x100006e28) at thr-1.c:120

The program creates one thread and calls st_usleep(timeout); where
timeout is 1000, to force a context switch. Are there any required
changes to the stack context switch code in md.h for this combination?

I've tried to use setcontext() etc instead, but didn't get anywhere
either, the way I used it is probably wrong:

#define MD_SETJMP(env) getcontext(&(env))
#define MD_LONGJMP(env, val) setcontext(&(env))

_ST_INIT_CONTEXT:
  if (getcontext(&(thread->context)) != 0)
        return NULL;
  (thread)->context.uc_link = NULL;
  (thread)->context.uc_stack.ss_sp = (void *) (stack->sp);
  (thread)->context.uc_stack.ss_size = stk_size;
  (thread)->context.uc_stack.ss_flags = 0;
  makecontext(&(thread)->context, _st_thread_main, 1);



-------------------------------------------------------
This SF.net email is sponsored by: IBM Linux Tutorials.
Become an expert in LINUX or just sharpen your skills.  Sign up for IBM's
Free Linux Tutorials.  Learn everything from the bash shell to sys admin.
Click now! http://ads.osdn.com/?ad_id=1278&alloc_id=3371&op=click