Const initialize LOCK_LATCH thread local

This commit is contained in:
Daria Sukhonina
2026-04-23 16:06:24 +03:00
parent 92c7010294
commit 892f176d89
2 changed files with 2 additions and 2 deletions
+1 -1
View File
@@ -220,7 +220,7 @@ pub(super) struct LockLatch {
impl LockLatch {
#[inline]
pub(super) fn new() -> LockLatch {
pub(super) const fn new() -> LockLatch {
LockLatch { m: Mutex::new(false), v: Condvar::new() }
}
+1 -1
View File
@@ -524,7 +524,7 @@ unsafe fn in_worker_cold<OP, R>(&self, op: OP) -> R
OP: FnOnce(&WorkerThread, bool) -> R + Send,
R: Send,
{
thread_local!(static LOCK_LATCH: LockLatch = LockLatch::new());
thread_local!(static LOCK_LATCH: LockLatch = const { LockLatch::new() });
LOCK_LATCH.with(|l| {
// This thread isn't a member of *any* thread pool, so just block.