# Why do we need locks when a thread is waiting for an event from another thread?

**URL:** https://discourse.julialang.org/t/why-do-we-need-locks-when-a-thread-is-waiting-for-an-event-from-another-thread/110846
**Category:** General Usage
**Tags:** question, parallel, multithreading
**Created:** [February 27, 2024, 1:16pm UTC](https://discourse.julialang.org/t/why-do-we-need-locks-when-a-thread-is-waiting-for-an-event-from-another-thread/110846 "2024-02-27T13:16:18Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![Dandan](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/dandan/32/8935_2.png) [@Dandan](https://discourse.julialang.org/u/Dandan)
#### Post date: [February 27, 2024, 1:16pm UTC](https://discourse.julialang.org/t/why-do-we-need-locks-when-a-thread-is-waiting-for-an-event-from-another-thread/110846/1 "2024-02-27T13:16:18Z")

</div>

This is rather a general question about low level internals of parallel computing, I guess.

Suppose I have two threads and one is waiting for another to finish some job. In Julia I can program it with Threads.Condition, use locks and wait on it. But why is it necessary? Why a thread can’t just “callback” scheduler that will continue the execution of another thread?  
We don’t use locks to start an execution in a thread, then why it’s a problem to resume an execution?
