The code should be executed only in one thread, provided the application does not invoke socket operation in two different threads. That's the assumption of the library.