tests/mainloop: fix a race condition
tests/mainloop: fix a race condition

Rather than depending on the machine's speed/load, just interlock
between the two threads properly.

01org/android-bluez-glib,cosimoc/glib,endlessm/glib,krichter722/glib,bluez-android/glib,mzabaluev/glib,pstglia/platform-external-bluetooth-glib,iConsole/Console-OS_external_bluetooth_glib,mzabaluev/glib,pstglia/external-bluetooth-glib,endlessm/glib,pstglia/external-bluetooth-glib,01org/android-bluez-glib,MathieuDuponchelle/glib,krichter722/glib,tchakabam/glib,iConsole/Console-OS_external_bluetooth_glib,justinkb/aosp-bluez.glib,darren-clark/android_platform_external_bluetooth_glib,mzabaluev/glib,pstglia/platform-external-bluetooth-glib,Distrotech/glib,cention-sany/glib,cention-sany/glib,endlessm/glib,gale320/glib,iConsole/Console-OS_external_bluetooth_glib,cosimoc/glib,mzabaluev/glib,gale320/glib,cosimoc/glib,cention-sany/glib,pstglia/platform-external-bluetooth-glib,MathieuDuponchelle/glib,MathieuDuponchelle/glib,johne53/MB3Glib,justinkb/aosp-bluez.glib,endlessm/glib,tamaskenez/glib,MathieuDuponchelle/glib,djdeath/glib,krichter722/glib,endlessm/glib,djdeath/glib,darren-clark/android_platform_external_bluetooth_glib,lukasz-skalski/glib,tchakabam/glib,bluez-android/glib,lukasz-skalski/glib,tamaskenez/glib,iConsole/Console-OS_external_bluetooth_glib,pstglia/external-bluetooth-glib,cention-sany/glib,johne53/MB3Glib,01org/android-bluez-glib,tamaskenez/glib,Distrotech/glib,djdeath/glib,tamaskenez/glib,cention-sany/glib,Distrotech/glib,iConsole/Console-OS_external_bluetooth_glib,johne53/MB3Glib,mzabaluev/glib,darren-clark/android_platform_external_bluetooth_glib,djdeath/glib,ieei/glib,lukasz-skalski/glib,bluez-android/glib,darren-clark/android_platform_external_bluetooth_glib,pstglia/platform-external-bluetooth-glib,tamaskenez/glib,tchakabam/glib,Distrotech/glib,ieei/glib,justinkb/aosp-bluez.glib,lukasz-skalski/glib,johne53/MB3Glib,justinkb/aosp-bluez.glib,bluez-android/glib,bluez-android/glib,tchakabam/glib,justinkb/aosp-bluez.glib,krichter722/glib,krichter722/glib,pstglia/external-bluetooth-glib,01org/android-bluez-glib,johne53/MB3Glib,darren-clark/android_platform_external_bluetooth_glib,01org/android-bluez-glib,gale320/glib,gale320/glib,pstglia/external-bluetooth-glib,pstglia/platform-external-bluetooth-glib,cosimoc/glib,ieei/glib,johne53/MB3Glib,ieei/glib,cosimoc/glib,gale320/glib,Distrotech/glib,lukasz-skalski/glib,tchakabam/glib,ieei/glib,MathieuDuponchelle/glib,djdeath/glib