1' Copyright (c) 2025 Huawei Device Co., Ltd. 2' Licensed under the Apache License, Version 2.0 (the "License"); 3' you may not use this file except in compliance with the License. 4' You may obtain a copy of the License at 5' 6' http://www.apache.org/licenses/LICENSE-2.0 7' 8' Unless required by applicable law or agreed to in writing, software 9' distributed under the License is distributed on an "AS IS" BASIS, 10' WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 11' See the License for the specific language governing permissions and 12' limitations under the License. 13 14@startuml 15box "Worker thread #1" #LightBlue 16participant "coroutine A" 17participant "coroutine C" 18participant "Thread #1" 19end box 20 21box "Worker thread #2" #Orange 22participant "coroutine B" 23participant "coroutine D" 24participant "Thread #2" 25end box 26 27"coroutine A" -> "Thread #1": start execution 28note left 29 // coroutine A could acquire locks A and B 30end note 31"coroutine C" -> "Thread #1": added to execution list for this Thread 32note right 33 // coroutine C could release lock A 34end note 35"coroutine B" --> "Thread #2": start execution 36note left 37 // coroutine B could acquire locks A and B 38end note 39"coroutine D" --> "Thread #2": added to execution list for this Thread 40note right 41 // coroutine D could release lock B 42end note 43"Thread #1" -> "Thread #1": acquire Lock A 44"Thread #2" -> "Thread #2": acquire Lock B 45"Thread #1" -> "Thread #1": try to acquire Lock B, locked via pthread_mutex_lock 46"Thread #2" -> "Thread #2": try to acquire Lock A, locked via pthread_mutex_lock 47"Thread #1" -> "Thread #1" 48note left #red 49 Thread #1 can't be unlocked because coroutine D can't be scheduled 50end note 51"Thread #2" -> "Thread #2" 52note left #red 53 Thread #2 can't be unlocked because coroutine C can't be scheduled 54end note 55@enduml