Conversation
Thread-specific logging is difficult to initialize when the user doesn't control thread creation, as in environments like .NET.
The Application instance takes ownership of these objects. Changing the interface to use unique_ptr reflects this and prevents errors like the double-delete during application teardown that was previously occurring.
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #1904 +/- ##
=======================================
Coverage 74.09% 74.10%
=======================================
Files 444 444
Lines 55516 55514 -2
Branches 9128 9128
=======================================
+ Hits 41137 41138 +1
+ Misses 11287 11285 -2
+ Partials 3092 3091 -1 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
|
Some background here: In the .NET assembly, I want to use a module initializer to set the log callback. A module initializer ensures some initialization is run before any user code. In order to achieve this initialization previously, I was using a static constructor in the the
The second one will likely only cause a minimal case in every-day use, but the first requires a very awkward library design. When switching to a module initializer, I found that logging tests started failing. It turns out this was because the runtime was running the initializer on a different thread from the one the tests were running on. Thus, the logCallback was not getting invoked because it was only applied to the thread the on which the initializer run. By applying this commits on this PR, the test started working again. |
|
Fwiw, the PR appears to have broken the post-merge Cython test, although it’s never clear whether it’ll wash out as the pre-release progresses |
|
From my reading of that error log, I don't think it's anything in this PR that broke that test, but a change in the pre-release Cython. It is a bit concerning though, if there are changes in Cython that are going to break our somewhat non-standard practice of compiling multiple Cython source files and linking them as a single extension module. |
Changes proposed in this pull request
control thread creation, as in environments like .NET.
Loggerobjects. TheApplicationinstance takes ownership of these objects. Changingthe interface to use
unique_ptrreflects this and prevents errors like the double-delete during application teardown that was previously occurring (as identified by @burkenyo).Checklist
scons build&scons test) and unit tests address code coverage