Use sync RwLock for debug_logging

This avoids the need for potentially expensive block_in_place(),
but is unlikely to actually block the thread as holding write lock is rare.
This commit is contained in:
link2xt
2023-04-16 18:48:06 +00:00
parent 2b7ee85e30
commit 4716fcef94
5 changed files with 17 additions and 9 deletions

View File

@@ -2466,9 +2466,9 @@ sth_for_the = "future""#
include_bytes!("../test-data/webxdc/minimal.xdc"),
)
.await?;
assert!(alice.debug_logging.read().await.is_none());
assert!(alice.debug_logging.read().unwrap().is_none());
send_msg(&alice, chat_id, &mut instance).await?;
assert!(alice.debug_logging.read().await.is_some());
assert!(alice.debug_logging.read().unwrap().is_some());
alice.emit_event(EventType::Info("hi".to_string()));
alice