coexist with pthread
"Koji Namekata" <[email protected]> Fri, 17 Mar 2006 17:35:03 +0900
| Newsgroups | gmane.comp.lib.state-threads.user |
|---|---|
| Message-ID | <[email protected]> |
Hi,
Is it inherently impossible that state-threads coexist with pthread?=20
I am trying to execute a test program shown below. Is there anyone to
make a similar attempt?
-----
Results:
Linux 2.4.* Linuxthreads: SEGV
FreeBSD 4.* libc_r: Fatal error '_longjmp()ing between thread
contexts is undefined by POSIX 1003.1'
WinXP Cygwin: Runnable(!)
Program:
#include <stdio.h>
#include <pthread.h>
#include <st.h>
static void *p_thread(void *arg)
{
=09while (1) {
=09=09printf("child pthread [%p]\n", pthread_self());
=09=09sleep(5);
=09}
=09return NULL;
}
static void *s_thread(void *arg)
{
=09while (1) {
=09=09printf("child sthread [%p]\n", st_thread_self());
=09=09st_sleep(5);
=09}
=09return NULL;
}
int main(int argc, char *argv[])
{
=09pthread_t pth;
=09st_thread_t sth1, sth2;
=09pthread_create(&pth, NULL, p_thread, NULL);
=09printf("parent pthread [%p]\n", pthread_self());
=09st_init();
=09sth1 =3D st_thread_create(s_thread, NULL, 0, 0);
=09sth2 =3D st_thread_create(s_thread, NULL, 0, 0);
=09st_sleep(100);
=09return 0;
}
-----
Regards,
--
Koji Namekata
-------------------------------------------------------
This SF.Net email is sponsored by xPML, a groundbreaking scripting language
that extends applications into web and mobile media. Attend the live webcast
and join the prime developer group breaking into this new coding territory!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=110944&bid=241720&dat=121642