mirror of
https://github.com/fish-shell/fish-shell.git
synced 2024-11-25 09:39:52 +08:00
Minor cleanup of JobId::acquire
This commit is contained in:
parent
4036b1ab95
commit
238d9bf3a5
|
@ -302,7 +302,7 @@ impl JobId {
|
||||||
|
|
||||||
/// Return a `JobId` that is greater than all extant job ids stored in [`CONSUMED_JOB_IDS`].
|
/// Return a `JobId` that is greater than all extant job ids stored in [`CONSUMED_JOB_IDS`].
|
||||||
/// The `JobId` should be freed with [`JobId::release()`] when it is no longer in use.
|
/// The `JobId` should be freed with [`JobId::release()`] when it is no longer in use.
|
||||||
fn acquire() -> MaybeJobId {
|
fn acquire() -> JobId {
|
||||||
let mut consumed_job_ids = CONSUMED_JOB_IDS.lock().expect("Poisoned mutex!");
|
let mut consumed_job_ids = CONSUMED_JOB_IDS.lock().expect("Poisoned mutex!");
|
||||||
|
|
||||||
// The new job id should be greater than the largest currently used id (#6053). The job ids
|
// The new job id should be greater than the largest currently used id (#6053). The job ids
|
||||||
|
@ -312,7 +312,7 @@ impl JobId {
|
||||||
.map(JobId::next)
|
.map(JobId::next)
|
||||||
.unwrap_or(JobId(1.try_into().unwrap()));
|
.unwrap_or(JobId(1.try_into().unwrap()));
|
||||||
consumed_job_ids.push(job_id);
|
consumed_job_ids.push(job_id);
|
||||||
return MaybeJobId(Some(job_id));
|
job_id
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Remove the provided `JobId` from [`CONSUMED_JOB_IDS`].
|
/// Remove the provided `JobId` from [`CONSUMED_JOB_IDS`].
|
||||||
|
@ -360,7 +360,7 @@ impl JobGroup {
|
||||||
JobGroup::new(
|
JobGroup::new(
|
||||||
command,
|
command,
|
||||||
if wants_job_id {
|
if wants_job_id {
|
||||||
JobId::acquire()
|
MaybeJobId(Some(JobId::acquire()))
|
||||||
} else {
|
} else {
|
||||||
JobId::NONE
|
JobId::NONE
|
||||||
},
|
},
|
||||||
|
@ -375,7 +375,7 @@ impl JobGroup {
|
||||||
pub fn create_with_job_control(command: WString, wants_term: bool) -> JobGroup {
|
pub fn create_with_job_control(command: WString, wants_term: bool) -> JobGroup {
|
||||||
JobGroup::new(
|
JobGroup::new(
|
||||||
command,
|
command,
|
||||||
JobId::acquire(),
|
MaybeJobId(Some(JobId::acquire())),
|
||||||
true, /* job_control */
|
true, /* job_control */
|
||||||
wants_term,
|
wants_term,
|
||||||
)
|
)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user