Clemapfel / jluna

Julia Wrapper for C++ with Focus on Safety, Elegance, and Ease of Use
https://clemens-cords.com/jluna
MIT License
239 stars 12 forks source link

Idea: Use a manager thread to support full C++ multi-threading #62

Open eschnett opened 6 months ago

eschnett commented 6 months ago

I am calling Julia from C++ in kotekan, independent of jluna. (I was not aware of jluna when I implemented this.) kotekan is multi-threaded.

To support multi-threading, kotekan is using the following approach:

A "task" is a std::function<void(void)> wrapping a closure. A std::future is used to return the value from Julia to the calling thread.

See https://github.com/kotekan/kotekan/blob/1b930517ab9fbc71cbc02a787af197a316627a09/lib/core/juliaManager.hpp and https://github.com/kotekan/kotekan/blob/1b930517ab9fbc71cbc02a787af197a316627a09/lib/core/juliaManager.cpp for the implementation in kotekan. A similar implementation would be possible for jluna.