Yes, globals are shared between threads (technically, you could even access the stack of the thread if you have its address, or anything else). That's one reason they are bad "mult-threading" practice, since they result in subtle bugs.
A way to use "globals" without putting them on the stack (local vars) is to have only one "local var" for each thread (or TLS, but that's more complicated) that is a pointer to all the "globals". So instead of keeping your vars as globals, keep them in a struct -- and pass the address of the struct to any function that needs the globals. Then each thread would have its own "globals". Of course you'll have to make a new struct for every thread, but that's the point of threads.
fork creates a new process so there's no sharing. It's easier in your case, but it has far more overhead.
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum You cannot attach files in this forum You can download files in this forum