JuliaLang/julia — pull request #1002 by timholy (2012-07-02 12:55:33+00:00)
Title: RFC: multithreading?

I decided to test whether it would be possible to use pthreads (actually, libuv threads) with Julia. I was motivated to do this to avoid the overhead of creating DArrays. For example, if one wanted to create a parallel version of the "sum(v::Vector)" function, in most cases it might not be worth it do break into a DArray, do a parallel sum, and then recombine. I'm particularly motivated by the needs of the image library.

The result of my experiment is a segfault. Is this a "deep" problem, or am I doing something wrong? Or are there doable changes that could be made in Julia, e.g., suspending garbage collection?

A gist with the Julia test function is here https://gist.github.com/3033117

To get the segfault :-) you have to re-enable the calls to ``uv_thread_create`` and ``uv_thread_join`` (and best to disable the call to ``jl_apply``).