PengZheng commented on PR #818: URL: https://github.com/apache/celix/pull/818#issuecomment-4035253585
> > I just studied the [Win32 API of TLS](https://learn.microsoft.com/en-us/windows/win32/dlls/using-thread-local-storage-in-a-dynamic-link-library), and found that it maps nicely to our current implementation: > > Windows POSIX > > DllMain/DLL_PROCESS_ATTACH CELIX_ERR_CONSTRUCTOR > > DllMain/DLL_THREAD_DETACH POSIX TLS destructor > > DllMain/DLL_PROCESS_DETACH CELIX_ERR_DESTRUCTOR > > For Win32 support, implementing `_WIN32` protected `DllMain` will be easy. For POSIX platforms, we just take advantage of the non-portable `pthread_key_create`. No need for global registry or extra thread monitoring mechanism. > > WDYT? @pnoltes > > Note that option 4 does not work because we cannot rely on a "shadow" `pthread_key` to cleanup other LTS according to man pages: > > ``` > > The order of destructor calls is unspecified if more than one destructor exists for a thread when it exits. > > ``` > > I agree, so this means we will reject this PR. I do think it is wise to move the tss api to a separate header (instead of the threads header). Why reject this PR? We can still easily add Windows support to the Celix ERR. -- 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. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
