How do I call a function in a separate thread in Julia 0.5-dev?

I know that supporting native flows in Julia is still incomplete, but I want to live on the verge of bleeding. I built the main branch with JULIA_THREADS=1 , and automatic multithreading with @threads works fine.

I want to just call my own function in a separate thread. AFAIK jl_threading_run used by @threads is not suitable for me because it will call my function in several threads at the same time. Of course, I can try to get around this behavior by checking the thread number and working in only one of them. But I am sure that a more direct path should exist. I looked at the C implementation of multithreading support, but my knowledge of the internal functions of C and Julia is not enough to understand how to complete my task.

+5
source share

Source: https://habr.com/ru/post/1245905/


All Articles