Sets the mode up once, then holds what its runs can't share.
(self)
| 102 | |
| 103 | /// Sets the mode up once, then holds what its runs can't share. |
| 104 | fn acquire(self) -> ModeGuard { |
| 105 | setup(self.name()); |
| 106 | let fifo = || Some(RUNNER_FIFO.lock().unwrap_or_else(PoisonError::into_inner)); |
| 107 | match self { |
| 108 | Mode::Simulation => ModeGuard { |
| 109 | _shared_uprobes: Some(UPROBES.read().unwrap_or_else(PoisonError::into_inner)), |
| 110 | ..Default::default() |
| 111 | }, |
| 112 | Mode::Walltime { .. } => ModeGuard { |
| 113 | _runner_fifo: fifo(), |
| 114 | ..Default::default() |
| 115 | }, |
| 116 | Mode::Memory => ModeGuard { |
| 117 | _exclusive_uprobes: Some(UPROBES.write().unwrap_or_else(PoisonError::into_inner)), |
| 118 | _runner_fifo: fifo(), |
| 119 | ..Default::default() |
| 120 | }, |
| 121 | } |
| 122 | } |
| 123 | } |
| 124 | |
| 125 | /// Installs the mode's tools before any of its runs, which would otherwise race |