mirror of
https://github.com/launchbadge/sqlx
synced 2024-11-10 14:34:19 +00:00
replace deprecated compare_and_swap() with compare_exchange() (#1080)
This commit is contained in:
parent
d5f9f08c62
commit
edcc91c9f2
1 changed files with 6 additions and 6 deletions
|
@ -113,13 +113,13 @@ impl<DB: Database> SharedPool<DB> {
|
|||
let mut size = self.size();
|
||||
|
||||
while size < self.options.max_connections {
|
||||
let new_size = self.size.compare_and_swap(size, size + 1, Ordering::AcqRel);
|
||||
|
||||
if new_size == size {
|
||||
return Some(DecrementSizeGuard::new(self));
|
||||
match self
|
||||
.size
|
||||
.compare_exchange(size, size + 1, Ordering::AcqRel, Ordering::Acquire)
|
||||
{
|
||||
Ok(_) => return Some(DecrementSizeGuard::new(self)),
|
||||
Err(new_size) => size = new_size,
|
||||
}
|
||||
|
||||
size = new_size;
|
||||
}
|
||||
|
||||
None
|
||||
|
|
Loading…
Reference in a new issue