Looking for breakthrough ideas for innovation challenges? Try Patsnap Eureka!

Multi-thread control method and terminal equipment

A control method and multi-thread technology, applied in the directions of multi-programming device, resource allocation, etc., can solve problems such as camera abnormality and non-compliance, and achieve the effect of avoiding abnormality and avoiding adverse effects.

Pending Publication Date: 2022-04-15
QINGDAO HISENSE MOBILE COMM TECH CO LTD
View PDF0 Cites 0 Cited by
  • Summary
  • Abstract
  • Description
  • Claims
  • Application Information

AI Technical Summary

Problems solved by technology

[0007] 1. If the camera preview is required in thread A, it may happen that the camera is not turned on when the preview is executed, resulting in an abnormality of the camera;
[0008] 2. If camera preview is required in thread B, this does not meet the aforementioned requirement that opening the camera and camera preview must be performed in the same thread

Method used

the structure of the environmentally friendly knitted fabric provided by the present invention; figure 2 Flow chart of the yarn wrapping machine for environmentally friendly knitted fabrics and storage devices; image 3 Is the parameter map of the yarn covering machine
View more

Image

Smart Image Click on the blue labels to locate them in the text.
Viewing Examples
Smart Image
  • Multi-thread control method and terminal equipment
  • Multi-thread control method and terminal equipment
  • Multi-thread control method and terminal equipment

Examples

Experimental program
Comparison scheme
Effect test

Embodiment

[0125] Example: Combined Figure 4 As shown, the camera is opened and the camera is previewed, the initial value is 1, and the target value is 0 as an example.

[0126] S401. If it is necessary to open the camera in the first thread, set the status flag of the shared lock to 1 in the first thread, and block the first thread; in the polling sub-thread, poll the status flag of the shared lock ;

[0127] Wherein, the shared lock is a global lock, and each thread can set the shared lock.

[0128] Moreover, blocking the first thread means controlling the first thread to be in a blocked state.

[0129] S402, in the second thread, execute a specific camera opening program, and determine whether the camera is successfully opened according to the callback; if it is successfully opened, then set the status flag of the shared lock to 0 in the second thread, and execute S403; if not successful Open, keep the state of the shared lock marked as 1 in the second thread, and notify the user...

the structure of the environmentally friendly knitted fabric provided by the present invention; figure 2 Flow chart of the yarn wrapping machine for environmentally friendly knitted fabrics and storage devices; image 3 Is the parameter map of the yarn covering machine
Login to View More

PUM

No PUM Login to View More

Abstract

The invention discloses a multi-thread control method and terminal equipment, and the method comprises the steps: controlling a first thread to be in a blocked state when target operation needs to be carried out on the equipment in the first thread, so that the first thread does not continue to execute subsequent operation; at the moment, executing a program used for realizing the target operation in the second thread, and setting a state mark of the shared lock in the second thread according to an execution result; furthermore, whether the first operation is successfully executed or not can be determined according to the state mark of the shared lock, if the first operation is successfully executed, the first thread is awakened, the blocking state of the first thread is relieved, and subsequent operation can be continuously executed in the first thread; at the moment, when the follow-up operation is executed in the first thread, due to the fact that the previous target operation is executed successfully, the follow-up operation can be normally carried out, the abnormal phenomenon cannot occur, adverse effects on the follow-up operation are avoided, and therefore sequential execution of operation of different threads in the same thread in the asynchronous environment is achieved.

Description

technical field [0001] The invention relates to the technical field of microprocessors, in particular to a multi-thread control method and terminal equipment. Background technique [0002] In the android system, a set of camera apis based on the camera frame Camera1 is proposed (that is, the terminal device calls the application program interface of the camera in the terminal). The opening and preview of the camera in this api are performed sequentially in the same thread, and the camera preview must be It is performed after the camera is opened. [0003] After that, a new camera framework appeared, that is, Camera2, in which, the camera opening and camera preview all have a callback to notify the user of the final execution result of this operation. If the execution result is successful, the user can continue to perform subsequent operations; and, In Camera2, the camera is opened on the first thread, and the execution program and callback opened by the camera are all on th...

Claims

the structure of the environmentally friendly knitted fabric provided by the present invention; figure 2 Flow chart of the yarn wrapping machine for environmentally friendly knitted fabrics and storage devices; image 3 Is the parameter map of the yarn covering machine
Login to View More

Application Information

Patent Timeline
no application Login to View More
IPC IPC(8): G06F9/50
Inventor 王鹏
Owner QINGDAO HISENSE MOBILE COMM TECH CO LTD
Who we serve
  • R&D Engineer
  • R&D Manager
  • IP Professional
Why Patsnap Eureka
  • Industry Leading Data Capabilities
  • Powerful AI technology
  • Patent DNA Extraction
Social media
Patsnap Eureka Blog
Learn More
PatSnap group products