There are a number of precautions to take when using multiple threads, and it also depends on the type of application we are dealing with (console, windows, service, etc.)
In my quoted example, the main issue I had to deal with, as far as threading was concerned, was using "printf" from multiple threads. printf is not thread safe. While in the SDK example that I took as inspiration, they simply did not use the printf, obviously for that reason, I decided to keep with it but allow access to only 1 thread at a time by using a semaphore.