It may be possible, but I got weird results with using standard C++ threading in add-ons. What I ended up doing was spawning a thread in GDScript, and then calling my C++ function from there, which seemed to work better. Also, threads joining themselves is really error prone. It's best to use some sort of atomic or outside check to see if the results are done, and then join from the main thread (e.g. in GDScript).