BRL-CAD / brlcad

BRL-CAD is a powerful cross-platform open source combinatorial solid modeling system
https://brlcad.org
Other
686 stars 140 forks source link

suppress bu_log from multiple threads simultaneously #106

Open kennethsdavis opened 9 months ago

kennethsdavis commented 9 months ago

There is a semaphore global to log.c that is intended to protect calls to bu_hook_call (via log_call_hooks). Because log_call_hooks can only be called if the log_hook_list is non-empty this semaphore only gets initialized when bu_log_add_hook is called the first time.

I considered the FIXME note at the top of log.c as a strong candidate for implementation from a design standpoint, but favored this solution because its development cost and risk are both low.

This pull request satisfies https://github.com/BRL-CAD/brlcad/issues/100

kennethsdavis commented 9 months ago

Testing was performed against 7.36.0 because main HEAD won't build brlcad.dll at the time of this comment (see https://github.com/BRL-CAD/brlcad/issues/105). The sample application on https://github.com/BRL-CAD/brlcad/issues/100 executes as expected after applying this change.