Coroutine running method and device, computer device and storage medium
By creating a new thread and allocating an execution lock when a coroutine switching exception occurs, the efficiency reduction problem caused by coroutines occupying resources on the same operating system thread is solved, thus achieving efficient operation of coroutines and full utilization of resources.
CN115408117BActive Publication Date: 2026-07-24TENCENT TECHNOLOGY (SHENZHEN) CO LTD
View PDF 2 Cites 0 Cited by
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- TENCENT TECHNOLOGY (SHENZHEN) CO LTD
- Filing Date
- 2021-05-28
- Publication Date
- 2026-07-24
Smart Images

Figure CN115408117B_ABST
Abstract
The application relates to a coroutine running method and device, computer equipment and a storage medium. The method comprises the following steps: when a first coroutine running in a target thread causes an exception in switching to a second coroutine due to occupying a resource bound by the target thread, the target thread and the first coroutine are set to a stop state; a new thread is created, and an execution lock of the target thread is allocated to the new thread; the second coroutine is run based on the new thread to which the execution lock has been allocated; when the second coroutine running ends and the target thread enters a waiting state from the stop state, the new thread is terminated, and the execution lock of the new thread is released to the target thread; and the first coroutine is continuously run through the target thread. The method can improve the running efficiency of the coroutine.
Need to check novelty before this filing date? Find Prior Art