So i'm getting the hang of using c/c++ but i'm still a bit misguided. I'm also trying to learn synchronization at the same time so things aren't going perfect.
So my potential problem here is,
sem_wait call will execute in the thread in which it was called (as @Jason C points out in his comment). From what you've described that happens in
run after the thread has been started, hence
sem_wait will be executed in the first thread.
You seem to be thinking that because the
Node object is used in both threads that somehow has an effect on which thread will execute a call. It doesn't. Threads share memory space so your
Node object can be used in any thread within a process. That's when you start getting into thread safety issues.