🎨 Name the asked buffer's ticket as held for its drop alone
An asked buffer's state held its ticket in a tuple field that nothing reads: the ticket is kept only so that its drop gives it back to the commit order when the buffer's commit, or its end uncommitted, leaves the state. Clippy on macOS rejected the field as never read. The field is now named `_ticket`, and its comment says why it is held. Nothing the guest or the host observes changes.
This commit is contained in:
1 parent
6a10f9f2d3
commit
46cb7f4daa
1 file changed
+8
-4
@@ -515,8 +515,10 @@ pub(crate) struct Askable {
|
||||
enum Asking {
|
||||
/// Begun and not yet committed, its record unposted.
|
||||
Begun(Arc<Scheduled>),
|
||||
/// Asked before its commit: its record posted, its ticket out until its commit.
|
||||
Asked(Option<Ticket>),
|
||||
/// Asked before its commit: its record posted, its ticket out until its commit. Nothing reads
|
||||
/// the ticket: it is held for its drop, which gives it back to the commit order where
|
||||
/// [`Askable::end`] leaves this state, at the buffer's commit or as it ends uncommitted.
|
||||
Asked { _ticket: Option<Ticket> },
|
||||
/// Committed before an ask: an ask posts its record at once, with no ticket, as its commit
|
||||
/// already has its place.
|
||||
Committed(Arc<Scheduled>),
|
||||
@@ -529,7 +531,7 @@ impl Askable {
|
||||
/// Whether an ask may still post its record, or it holds its ticket.
|
||||
fn open(&self) -> bool {
|
||||
match &*self.state.lock() {
|
||||
Asking::Begun(_) | Asking::Asked(_) => true,
|
||||
Asking::Begun(_) | Asking::Asked { .. } => true,
|
||||
Asking::Committed(scheduled) => !scheduled.is_posted(),
|
||||
Asking::Ended => false,
|
||||
}
|
||||
@@ -543,7 +545,9 @@ impl Askable {
|
||||
let mut state = self.state.lock();
|
||||
match std::mem::replace(&mut *state, Asking::Ended) {
|
||||
Asking::Begun(scheduled) => {
|
||||
*state = Asking::Asked(sequencer.issue(self.context, false));
|
||||
*state = Asking::Asked {
|
||||
_ticket: sequencer.issue(self.context, false),
|
||||
};
|
||||
scheduled
|
||||
}
|
||||
Asking::Committed(scheduled) => scheduled,
|
||||
|
||||
Reference in new issue
Block a user