Home » Community » U++ community news and announcements » "Raw" thread support
"Raw" thread support [message #35957] |
Sun, 08 April 2012 19:21 |
|
mirek
Messages: 13975 Registered: November 2005
|
Ultimate Member |
|
|
Primary motivation for this feature was creation of asynchronous DNS resolver IpAddrInfo.
The problem is that there are no easy to use nonblocking APIs for DNS, getaddrinfo is blocking.
The easiest solution to the situation is to use separate thread to perform blocking call. Anyway, I want still to keep single-threaded mode, because some code can run 5-15% faster if compiled single-threaded. This is because in single-threaded mode, most synchronization routines are just NOPs.
Anyway, that does not preclude to have auxiliary threads in single-threaded, if some rules are followed. Basically, if nothing related to U++ heap is used, it should be OK.
It is also worth to encapsulate two basic MT features, StartRawThread and RawMutex, to avoid platform differences. StartRawThread and RawMutex thus exist and work even in single-threaded mode...
To see more details, examine IpAddrInfo.
|
|
|
Goto Forum:
Current Time: Mon Apr 29 09:06:33 CEST 2024
Total time taken to generate the page: 0.02390 seconds
|