Ccall of a thread C function from REPL

Hello,

I’ve made a standalone GUI application in C++ and I can call it from Julia REPL. To achieve this, I exported a C function named int entry_point() calling the GUI which loops for ever until the user close the window. I compiled this function as a shared library.

julia> ccall((:entry_point, "/usr/lib/libmyapplication.so"), Int, ())
0

This is working well, but I have no longer access to the REPL and I want to extend the API of my GUI application to allow me to return some result that I can exploit from the REPL, something like this:

julia> handle = ccall(...)

... the gui is working ...

julia> foo = my_function(handle)
result

... the gui is working ...

For the moment, I do not know how to thread my entry_point function. If I call std::thread without calling join() the REPL will crash. Is there a good way to tell Julia to thread my ccall and let me access to the REPL ?

Thanks