hundreds-breakfast-49010
07/12/2019, 6:14 PMwitty-crayon-22786
07/12/2019, 6:17 PMwitty-crayon-22786
07/12/2019, 6:18 PMhundreds-breakfast-49010
07/12/2019, 6:28 PM<http://scheduler.rs|scheduler.rs>
, which looks like the only place we create a EngineDisplay
, should I be immediately getting a mutable reference to the logger singleton and adding a reference to that newly-created EngineDisplay
in that code?hundreds-breakfast-49010
07/12/2019, 6:28 PMhundreds-breakfast-49010
07/12/2019, 6:29 PMEngineDisplay
reference from Logger
when no longer needed, which will probably cause a borrow check error when I actually code this upwitty-crayon-22786
07/12/2019, 6:29 PMwitty-crayon-22786
07/12/2019, 6:30 PM./pants --no-v1 --v2 --v2-ui test tests/python/pants_test/util:dirutil
witty-crayon-22786
07/12/2019, 6:31 PMwitty-crayon-22786
07/12/2019, 6:31 PMhundreds-breakfast-49010
07/12/2019, 6:32 PMEngineDisplay::log
is a curses-ui-aware way of logging to consolehundreds-breakfast-49010
07/12/2019, 6:33 PMEngineDisplay
we want to avoid calling the existing logging functionalityhundreds-breakfast-49010
07/12/2019, 6:33 PMEngineDisplay::log
hundreds-breakfast-49010
07/12/2019, 6:33 PMlog
function on the Log
trait that Logger
implementshundreds-breakfast-49010
07/12/2019, 6:34 PMDestination
, right?witty-crayon-22786
07/12/2019, 8:33 PMwitty-crayon-22786
07/12/2019, 8:33 PMwitty-crayon-22786
07/12/2019, 8:33 PMhundreds-breakfast-49010
07/12/2019, 9:11 PMDestination::Stderr
, Logger
should also log to every one of its list of EngineDisplay
(which might be empty)hundreds-breakfast-49010
07/12/2019, 9:11 PMPantsd
, just ignore thathundreds-breakfast-49010
07/12/2019, 9:12 PMEngineDisplay::log
expects a string but Logger
expects to deal with a more complicated Record
data structurehundreds-breakfast-49010
07/12/2019, 9:13 PMEngineDisplay
witty-crayon-22786
07/12/2019, 9:13 PMhundreds-breakfast-49010
07/12/2019, 9:18 PMEngineDisplay
requires a &mut self
reference to call its .log()
method, but the Log
trait requires that log
be &self
hundreds-breakfast-49010
07/12/2019, 9:21 PMEngineDisplay
on a Logger
I only have an immutable reference otwitty-crayon-22786
07/12/2019, 9:23 PMArc<Mutex<T>>
hundreds-breakfast-49010
07/12/2019, 9:25 PMVec<Arc<Mutex<EngineDisplay>>>
on Logger
, and then I can call methods on the Arc<Mutex<_>> to get me a mutable reference to itwitty-crayon-22786
07/12/2019, 9:31 PMwitty-crayon-22786
07/12/2019, 9:31 PM<http://scheduler.rs|scheduler.rs>
in the same way, because the EngineDisplay would now be a thing shared between multiple threadswitty-crayon-22786
07/12/2019, 9:33 PMVec<Arc<Mutex<EngineDisplay>>>
... it's possible that because you need to be able to add at the beginning and remove at the end, you might make it a Map<SomeUniqueIdThingie, Arc<Mutex<EngineDisplay>>>
insteadwitty-crayon-22786
07/12/2019, 9:33 PMhundreds-breakfast-49010
07/12/2019, 9:34 PMhundreds-breakfast-49010
07/12/2019, 9:34 PMwitty-crayon-22786
07/12/2019, 9:34 PMMutex
doesn't implement Hashwitty-crayon-22786
07/12/2019, 9:34 PMhundreds-breakfast-49010
07/12/2019, 9:34 PMhundreds-breakfast-49010
07/12/2019, 9:35 PMEngineDisplay
gets created in Session::new
and I assume only gets destroyed in `Session`'s implicit Dropwitty-crayon-22786
07/12/2019, 9:36 PMfn add_engine_display(Arc<Mutex<EngineDisplay>>) -> SomeUniqueId;
fn remove_engine_display(SomeUniqueId);
hundreds-breakfast-49010
07/12/2019, 9:36 PMSession
should be in charge of making sure that the global logger gets registered with a new EngineDisplay
on creation, and loses it on destructionwitty-crayon-22786
07/12/2019, 9:37 PMwitty-crayon-22786
07/12/2019, 9:37 PM<http://scheduler.rs|scheduler.rs>
witty-crayon-22786
07/12/2019, 9:37 PMhundreds-breakfast-49010
07/12/2019, 9:42 PMScheduler::execute
?hundreds-breakfast-49010
07/12/2019, 9:42 PMwitty-crayon-22786
07/12/2019, 9:52 PMhundreds-breakfast-49010
07/13/2019, 1:21 AMhundreds-breakfast-49010
07/13/2019, 1:22 AM<http://scheduler.rs|scheduler.rs>
I think I can only get access to the unlocked EngineDisplay
via MutexGuard
, which is the wrapper (which derefmut's to &mut EngineDisplay
) from .lock()
on a Mutexhundreds-breakfast-49010
07/13/2019, 1:23 AMEngineDisplay
in the LOGGER
singleton, which has lifetime problemshundreds-breakfast-49010
07/13/2019, 1:23 AMwitty-crayon-22786
07/13/2019, 2:52 AMwitty-crayon-22786
07/13/2019, 2:53 AM