Last active
August 29, 2015 14:12
-
-
Save jamwt/c77389b89aa54d42f886 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
impl<'a, C: 'a + AbstractConnection + Send> ConnPool<'a, C> { | |
pub fn borrow(&'a self) -> Result<ScopedConn<C>, IoError> { | |
// With pool-wide lock, pick a host. | |
let host_pool: Arc<HostPool<'a, C>> = try!({ | |
let mut pool = self.pool.lock(); | |
pool.pick_host().clone() | |
}); | |
// Acquire connection with narrower locking. | |
host_pool.lease(self.max_idle_conns, &self.make_conn) | |
} | |
} |
Author
jamwt
commented
Dec 29, 2014
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment