• Hugo Lefeuvre's avatar
    threadloop: remove EXIT_IF_FAIL macro · f5257847
    Hugo Lefeuvre authored
    EXIT_IF_FAIL was meant to replace
    
    if (!(A)) {
        RING_ERR(__VA_ARGS__);
        loop_.exit();
    }
    
    but it is not very readable. Also, loop_.exit() throws an exception
    where setup functions calling EXIT_IF_FAIL could simply return
    false. Throwing an exception has a higher overhead and leads to less
    readable debug output (+ throwing exceptions should never be the
    standard way to exit the normal control flow).
    
    This patch
    - removes the EXIT_IF_FAIL macro
    - replaces code from audio_rtp_session and video_receive_thread which
      was using this macro
    - Adds stop() call at the end of ThreadLoop::mainloop. At this point
      the thread loop is obviously not executing anymore.
    
    Change-Id: Id1ed8eb914e91686a63775eba3ad70f8b6143ae5
    Reviewed-by: Philippe Gorley's avatarPhilippe Gorley <philippe.gorley@savoirfairelinux.com>
    f5257847
threadloop.cpp 3.53 KB