Hi. I use latest version of ECL from git and try to call lisp code in
different threads.
The following code fails (sigsegv) inside ecl_import_current_thread.
#include<ecl/ecl.h>
#include<pthread.h>
#include<unistd.h>
#include<stdio.h>
void *thread_foo(void *p){
(void)p;
printf("--1\n"); /* print 5 times */
ecl_import_current_thread(Cnil,Cnil);
printf("--2\n"); /* no prints */
int i=0;
for(;i<3;i++){
sleep(1);
printf("%d\n",i);}
ecl_release_current_thread();
return 0;}
int main(int argc,char **argv){
cl_boot(argc,argv);
pthread_t thr[5];
int i;
for(i=0;i<sizeof(thr)/sizeof(*thr);i++){
pthread_create(&thr[i],0,thread_foo,0);}
for(i=0;i<sizeof(thr)/sizeof(*thr);i++){
pthread_join(thr[i],0);}
return 0;}
The same code without any ecl calls (cl_boot, ecl_make.., ecl_release..) works
fine.
What am I doing wrong? How to call lisp code in few threads?
------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and
threat landscape has changed and how IT managers can respond. Discussions
will include endpoint security, mobile security and the latest in malware
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
Ecls-list mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ecls-list