register_endpoint: simplify locking

This commit is contained in:
Martin Hurton 2012-03-22 06:51:41 +01:00
parent e56f698023
commit ae2b938330

View File

@ -297,13 +297,14 @@ int zmq::ctx_t::register_endpoint (const char *addr_, endpoint_t &endpoint_)
bool inserted = endpoints.insert (endpoints_t::value_type ( bool inserted = endpoints.insert (endpoints_t::value_type (
std::string (addr_), endpoint_)).second; std::string (addr_), endpoint_)).second;
endpoints_sync.unlock ();
if (!inserted) { if (!inserted) {
errno = EADDRINUSE; errno = EADDRINUSE;
endpoints_sync.unlock ();
return -1; return -1;
} }
endpoints_sync.unlock ();
return 0; return 0;
} }