test_syscalls.cc: Fix use of futex() when waiting for thread
test_syscalls.cc: Fix use of futex() when waiting for thread

FUTEX_WAIT will return EAGAIN if *tid_ptr != tid, though this is not
made clear on the man page.  So change the code to handle the case
where the thread has exited between the "while" check and the futex()
call.  Otherwise, the test could be flaky.

Found while working towards:
BUG=http://code.google.com/p/seccompsandbox/issues/detail?id=2
TEST=This can be tested by inserting "poll(0, 0, 500);" before the
  futex() call.  This affects test_clone and test_clone_preserves_registers.

Review URL: http://codereview.chromium.org/3592005
marylinh/seccompsandbox,aman-iitj/seccompsandbox,dj091111/seccompsandbox,marylinh/seccompsandbox,dj091111/seccompsandbox,dj091111/seccompsandbox,marylinh/seccompsandbox,aman-iitj/seccompsandbox,aman-iitj/seccompsandbox