[Ecls-list] multi-threaded C++ app

Dean O'Connor dean.oconnor at ite.com.au
Tue Oct 25 00:46:14 UTC 2005


Thanks :) I have refreshed from CVS and tested your example and my app 
on our Gentoo linux box.
Am just doing a few more tests to verify for sure, but they both seem to 
work ok.

However, I can't even compile with MSVC 6.0 (with ECL_THREADS).

If I don't include the "gc.h" include, it will compile. But if I include 
it, I get these errors.

 >>>>
c:\projects\lisp\ecls\msvc\h\gc.h(141) : warning C4273: 'GC_dont_gc' : 
inconsistent dll linkage.  dllexport assumed.
c:\projects\lisp\ecls\msvc\h\gc.h(463) : error C2556: 'void *__cdecl 
GC_malloc_ignore_off_page(unsigned int)' : overloaded function differs 
only by return type from 'char *__cdecl 
GC_malloc_ignore_off_page(unsigned int)'
        c:\projects\lisp\ecls\src\h\external.h(193) : see declaration of 
'GC_malloc_ignore_off_page'
c:\projects\lisp\ecls\msvc\h\gc.h(463) : error C2371: 
'GC_malloc_ignore_off_page' : redefinition; different basic types
        c:\projects\lisp\ecls\src\h\external.h(193) : see declaration of 
'GC_malloc_ignore_off_page'
c:\projects\lisp\ecls\msvc\h\gc.h(464) : error C2556: 'void *__cdecl 
GC_malloc_atomic_ignore_off_page(unsigned int)' : overloaded function 
differs only by return type from 'char *__cdecl 
GC_malloc_atomic_ignore_off_page(unsigned int)'
        c:\projects\lisp\ecls\src\h\external.h(194) : see declaration of 
'GC_malloc_atomic_ignore_off_page'
c:\projects\lisp\ecls\msvc\h\gc.h(464) : error C2371: 
'GC_malloc_atomic_ignore_off_page' : redefinition; different basic types
        c:\projects\lisp\ecls\src\h\external.h(194) : see declaration of 
'GC_malloc_atomic_ignore_off_page'
Generating Code...
Error executing cl.exe.
<<<<<

Cheers
Dean.

Juan Jose Garcia Ripoll wrote:

>On Thu, 2005-10-20 at 11:22 +1000, Dean O'Connor wrote:
>  
>
>>FYI ... as a test, I can call this function from my main thread, it 
>>doesn't crash.
>>
>>    ecl_import_current_thread(Cnil, Cnil);
>>
>>But still calling it from only from my worker threads still crashes.
>>That call was the first line of worker threads
>>    
>>
>
>Sorry for the delay, but this required some investigation. Basically I
>found two problems
>
>1) There was some bug in the implementation of si_make_process(), which
>assumed that the thread had already been imported and sometimes worked
>sometimes did not.
>
>2) I discovered that one has to create the threads using ECL's wrappers
>on top of either posix/windows threads. It is not really needed to
>change your code, but the application that creates the threads has to
>include <ecl.h> in order to get the calls
>pthread_create()/CreateThread() replaced with the ones that the garbage
>collector supplies. Otherwise garbage collection may fail on the
>imported threads.
>
>I supply a ZIP file with an example of how to do it under linux. I did
>not have time to prepare the Windows version, but it should be trivial.
>
>Regards,
>
>Juanjo
>
>  
>




More information about the ecl-devel mailing list