# Multithreading & Ccall & WIGXJPF

**URL:** <https://discourse.julialang.org/t/multithreading-ccall-wigxjpf/88697>\
**Category:** General Usage\
**Tags:** question\
**Created:** [October 13, 2022, 10:39pm UTC](https://discourse.julialang.org/t/multithreading-ccall-wigxjpf/88697 "2022-10-13T22:39:15Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![wes648](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/wes648/32/43541_2.png) [@wes648](https://discourse.julialang.org/u/wes648)\
**Post date:** [October 13, 2022, 10:39pm UTC](https://discourse.julialang.org/t/multithreading-ccall-wigxjpf/88697/1 "2022-10-13T22:39:15Z")

</div>

Hello!

I’m trying to modify the [WIGXJPF.jl wrapper](https://github.com/jagot/WIGXJPF.jl) to make it work with multithreading. Using the code pretty much as is (just adjusting for my personal paths), I get an error reading

> wigxjpf: Temp array not allocated. (For this thread?)

Below is the test script I am using to see if multithreading will work. Do I need to modify the **init** () function of WIGXJPF to make this work? I don’t know C currently so I’m very uncertain of how to proceed.

```julia
using Base.Threads
include("./WIGXJPF.jl")
using .WIGXJPF

nthr = nthreads()
out = zeros(Float64,nthr)

@threads for i in 1:nthr
   out[i] = wig3j(nthr,2,nthr,i,0,-i)
end

println(out)

```

Thanks in advance!
