Question: I just got a Beagle Board and started working with Cloud9. Everything worked fine until I tried to integrate it with Github. 

I could git init because I "didn't have sudo permissions" on Cloud9. Therefore, I cloned a repo to use with Cloud9. **Now, however, it looks like the Beagle Board dependencies are no longer there.** I get this error:

![enter image description here](https://i.stack.imgur.com/Zar2r.png)

The code I'm trying to run (which gets the error) is:

```
var b = require("bonescript");
b.pinMode('USR0', b.OUTPUT);
b.digitalWrite('USR0', b.HIGH);

```

Answer: 
The purpose of `join` is to, essentially, wait for the thread to complete. So once `Child->join();` returns, your thread has completed. Of course, you could also do `Child->join()` in the destructor [or at some other point, just make sure it is called at some point]. 

Note that, the thread will start running at some point between the time it actually created, and the end of join. There is no way of telling when that will happen. If you have lots of threads already running on the system, the time will be distributed between all threads, and your thread may not run for several seconds. On the other hand, if there is a CPU sitting there "twiddling it's fingers", it could quite possibly start before the main thread is out of the `new std::thread(...)` construction [because `std::thread` won't return until the thread has been properly created, and some data is being stored in the thread object, so the thread may well have completed by the time you get to `Child->join()`. There is no way to tell which of these options it is without knowing what state the system is in.
The operating system matters, but it is rather universal. The thread gets *scheduled* to execute. When the operating system gets around to actually make it run is entirely unpredictable. You'll have decent odds for "quickly" on a machine with multiple cores, universally available today.

thread::join() just ensures that the thread finished executing. You would *never* actually write code like this, it is completely pointless to start a thread and then wait for it to complete. Might as well execute the thread's code directly. Same outcome without bogging down the operating system with creating a thread.