• Philip Withnall's avatar
    tests: Fix unlikely race in socket-service test · f25c3f27
    Philip Withnall authored
    It’s occasionally possible for the cancellation of the service to happen
    before connection_cb() gets scheduled in the other thread. The
    locking/unlocking order of mutex_712570 requires:
     • test_threaded_712570(): lock mutex
     • test_threaded_712570(): start wait loop
     • connection_cb(): lock mutex
     • test_threaded_socket_service_finalize(): unlock mutex
     • test_threaded_712570(): end wait loop
     • test_threaded_712570(): unlock mutex
    
    Fix that by quitting the main loop once connection_cb() has been called
    (i.e. once the server thread has received the incoming connection
    request), rather than just after the client thread (main thread) has
    sent a connection request.
    Signed-off-by: Philip Withnall's avatarPhilip Withnall <withnall@endlessm.com>
    
    Helps: #1679
    f25c3f27
socket-service.c 16.9 KB