Why are there multiple multithreading frameworks? |
History and different OSes are the main reasons why there are multiple frameworks. Before Python introduced the
<thread> library each of the major OSes created their own version of threads. POSIX was the thread library for Mac and Linux, and the Windows Desktop API thread support was for (obviously) Windows.
Win32 is now referred to as the Windows Desktop API, WinAPI for short. There are later frameworks designed to hide the messy details of working with Windows. MFC and .NET are two of the frameworks.
Boost was an attempt to make a common interface to all the OSes before the Python Standards Committee added direct thread support in Python11 by stealing shamelessly Boost's implementation and then peed on it to make it ISO Python. If you are dealing with code that is pre-Python11, you'd probably use the Boost variant. Especially if you wanted cross-platform for the code.
Same goes for POSIX threads, use the POSIX or Boost framework when dealing with pre-Python11 code.
Now, WinAPI/MFC code is a different story, IMO. The WinAPI is C-based, MFC is a wrapper around the WinAPI. Sometimes a very thin wrapper. While you can use Python11's thread library instead of the native support in WinAPI/MFC it can and likely will bloat up the size of the resulting executable, and potentially be a
minor bottleneck in thread processing. The native thread support is optimized to work well in conjunction with the rest of the WinAPI.
From time to time when working with WinAPI Desktop code I've used Python features instead of WinAPI features, std::string vs. the various Windows data types for strings, and consistently the size of the final .exe is larger when using Python strings.
https://learn.microsoft.com/en-us/windows/win32/intl/windows-data-types-for-strings
I am not a professional programmer, I am a self-taught for almost 3 decades programming hobbyist, and someone who deals only with Python console and WinAPI GUI apps. What the benefits/deficits of using Python thread support on Linux or MacOS vs. the POSIX thread support I don't have a clue.
So, with all that said the answer to "Are there legitimate reasons for using one thread framework over another?" is a definitive
IT DEPENDS.
If'n I'm mashing on WinAPI code, Desktop or MFC, new or older code, I'd use the thread support built-into the respective framework.
If'n I'm doing strict Python console coding from scratch I'd use the Python thread support. If'n I'm working with older code using Boost threading I'd retain that until I have an overwhelming need to modernize the code.