Been about 25 checkins to the repository today, most of which was the result of yesterday's long coding session with final touchups today; also checked in the prior work on cgcomm done cpl days ago. Here's the complete [human-readable] listing of new stuff:
- unchain_ptr utility class (implementation, testsuite) [this was discussed in previous post]
- thread-safe smart pointers (implementation) - since shared_ptr isn't thread-safe, I wrote a thread-safe implementation of intrusive_ptr that uses external reference-counting mechanism. These pointers are now used by event-tables internally, as well as for ThreadWork's (objects passed to worker threads and back). The shared_ptr-based former implementation wasn't thread-safe at all, and it's surprising it didn't crash all the time really.
- WorkThread API - a queueing system that performs jobs in secondary thread - generalized and moved to hnbase library. The original WorkThread that was used for hashing and other IO-related tasks is now a derived class named IOThread. It's now possible to create arbitary worker threads reusing the [rather tricky] implementation.
- Rewrote DNS resolver API (interface, implementation, testsuite) dropping the original hand-made 1000-line version and now using WorkThread API to define a custom ResolverThread, that performs DNS lookups using blocking API call (currently gethostbyname, but will be upgraded to getaddrinfo, since the former is marked obsolete in POSIX 1003.1-2001). The resulting code is 123 lines, and also has a simpler usage syntax (see the testsuite).
- Improved DownloadList cache management and synchronization in cgcomm module.
- Added experimental support for pause(), resume() and stop() operations to core-gui communication.
- Upgrading libcgcomm (gui-side cgcomm support library) to use more modern C++ approach - now using signals for notifications, considerably simplifying usage and allowing more generic and fun programming (interface).
Madcat, ZzZz