Automation implementation using Busy Waiting or Threads in c++
===

I am trying to automate the handler equipment(a robot picks a chip and put it onto a hardware platform) with the following requirement:

1.there are 6 sites for the handler , once handler puts a device onto that site, handler will return an errorcode: 

code1 for ready to test, code2 for error, and if in process no code have returned.

2.I need to use that code to run some tests(which already implemented and working properly).
Handler puts the device in a FIFO order, first site returns code first, and last site returns code last. 

So my question would be: In this case, for the site-PCs(Windows based with perl and .net enabled), is busy waiting method better or is the wait condition mechanism suits better:

For example: the sample code would be:
 
    void runTestonSite()
    {
        for(;;)
        {
            if(returnCode == code1)
            {
                testStart(arg1,arg2,arg3);
            }
        }
    }

or is there any better way to do this kind of task?

    #include <boost/thread.hpp>
    
    void getReturnCode() { 
        // do stuff
    }

    void RunTestOnSite() { 
        // do stuff
    }
    
    int main (int argc, char ** argv) {
        using namespace boost; 
        thread thread_1 = thread(getReturnCode);
        thread thread_2 = thread(RunTestOnSite);
    
        // do other stuff
        thread_2.join();
        thread_1.join();
        return 0;
    }

Please advise,
thanks