Main thread and window thread are now synchronized. The main thread now
wait the signal from the window before continue, instead of waiting an
arbitrary 100ms. fix #5