Thread Safe Sockets.
1. Reorganise C API socket functions to eliminate bad practice of public functions calling other public functions. This should be done for msg's too but hasn't been in this patch. 2. Reorganise code in C API socket functions so that the socket is cast on one line, the C++ function called on the next with the result retained, then the result is returned. This makes the code much simpler to read and also allows pre- and post- call hooks to be inserted easily. 3. Insert pre- and post- call hooks which set and release a mutex iff the thread_safe flag is on. 4. Add the thread_safe_flag to base_socket_t initialised to false to preserve existing semantics. Add an accessor for the flag, add a mutex, and add lock and unlock functions. Note: as yet no code to actually set the flag.
Showing
Please
register
or
sign in
to comment