mgoulish opened a new pull request #1243: URL: https://github.com/apache/qpid-dispatch/pull/1243
I noticed that almost all calls to qd_log_source_lh() were very simple: take the lock, call the function, release the lock. But that means that we could move the lock take-and-release inside of that function, with no change in behavior. And then that means I don't have to ask the caller to add my new log_source (if it is new) to the list -- I can do that myself from within the function and simplify everything -- but do it after I drop the log_source_lock, so we don't get the lock inversion. SO I did that, and removed the _lh from the end of the function name -- but that made it collide with the name of another function. So I changed it to qd_log_source_find_or_make(). I.e. "if you don't find one of this name, then make it." The only slight disturbance was the function qd_log_entity() which took the lock and used it to cover this function and a couple other calls to a different _lh() function. SO for that one I just inserted new take-and-releases of the lock, right around the other function calls. Now there is only one line of code between each take-and-release, which seems much nicer. Also qd_log_source_reset() bugged me because it called my new function but then immediately had to take the lock just so it could set the log_source to default values. SO I just added a flag to my new fn so that qd_log_source_reset() could tell me to do that for him right after I retrieve it. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: [email protected] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
