# Equiavalent of @threadcall but for Julia code?

**URL:** <https://discourse.julialang.org/t/equiavalent-of-threadcall-but-for-julia-code/1335>\
**Category:** General Usage\
**Created:** [January 6, 2017, 9:09pm UTC](https://discourse.julialang.org/t/equiavalent-of-threadcall-but-for-julia-code/1335 "2017-01-06T21:09:12Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![jtravs](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/jtravs/32/2010_2.png) [@jtravs](https://discourse.julialang.org/u/jtravs)\
**Post date:** [January 6, 2017, 9:09pm UTC](https://discourse.julialang.org/t/equiavalent-of-threadcall-but-for-julia-code/1335/1 "2017-01-06T21:09:12Z")

</div>

Is there a way to run a Julia function on another thread? As far as I can tell the current (and I do understand experimental) threading support provides for parallel threaded for loops and @threadcall for calling a c function in a separate thread. But is there, or will there soon be, a way to run Julia code (i.e. a function, task etc.) on a separate thread?

---

<div class="post-metadata">

**Author:** ![StefanKarpinski](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/stefankarpinski/32/24_2.png) [@StefanKarpinski](https://discourse.julialang.org/u/StefanKarpinski)\
**Post date:** [January 6, 2017, 9:10pm UTC](https://discourse.julialang.org/t/equiavalent-of-threadcall-but-for-julia-code/1335/2 "2017-01-06T21:10:35Z")

</div>

Not at the moment. All Julia code must run in the main thread.

---

<div class="post-metadata">

**Author:** ![jtravs](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/jtravs/32/2010_2.png) [@jtravs](https://discourse.julialang.org/u/jtravs)\
**Post date:** [January 7, 2017, 8:16pm UTC](https://discourse.julialang.org/t/equiavalent-of-threadcall-but-for-julia-code/1335/3 "2017-01-07T20:16:25Z")

</div>

Is anything like this potentially on the roadmap? For many problems it is useful to have more general threading than just splitting iterations. I’m sure I read somewhere that Tasks might eventually have concurrent execution.

---

<div class="post-metadata">

**Author:** ![yuyichao](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/yuyichao/32/20_2.png) [@yuyichao](https://discourse.julialang.org/u/yuyichao)\
**Post date:** [January 7, 2017, 11:23pm UTC](https://discourse.julialang.org/t/equiavalent-of-threadcall-but-for-julia-code/1335/4 "2017-01-07T23:23:24Z")

</div>

It’s on the 1.0 roadmap to support cilk-like spawn but it’s likely post 1.0 goal to support manually creating new threads.

---

<div class="post-metadata">

**Author:** ![jtravs](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/jtravs/32/2010_2.png) [@jtravs](https://discourse.julialang.org/u/jtravs)\
**Post date:** [January 7, 2017, 11:37pm UTC](https://discourse.julialang.org/t/equiavalent-of-threadcall-but-for-julia-code/1335/5 "2017-01-07T23:37:37Z")

</div>

Great, a cilk-like spawn is exactly what I’m looking for. Is there somewhere I can see the plans / work in progress on this (an issue or branch on github?).

---

<div class="post-metadata">

**Author:** ![jtravs](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/jtravs/32/2010_2.png) [@jtravs](https://discourse.julialang.org/u/jtravs)\
**Post date:** [January 7, 2017, 11:42pm UTC](https://discourse.julialang.org/t/equiavalent-of-threadcall-but-for-julia-code/1335/6 "2017-01-07T23:42:35Z")

</div>

Looks like a relevant issue is:

[https://github.com/JuliaLang/julia/issues/17933](https://github.com/JuliaLang/julia/issues/17933)
