Multi-Thread Synchronization Method and Electronic Device

    公开(公告)号:US20220350602A1

    公开(公告)日:2022-11-03

    申请号:US17763490

    申请日:2020-09-21

    Abstract: A multi-thread synchronization method includes that a first thread requests to obtain a target lock. Then, the first thread checks the lock thread identifier field. The first thread checks the blocked thread quantity field when checking that the lock thread identifier field is a valid thread and is not the first thread. The first thread performs spin wait when checking that the blocked thread quantity field is less than a first threshold. When a quantity of times for spin wait reaches a second threshold and when it is checked that the lock thread identifier field is the valid thread and is not the first thread, the first thread performs an operation of adding 1 to the blocked thread quantity field, and suspends to enter a blocked state.

Patent Agency Ranking