Unlock instant, AI-driven research and patent intelligence for your innovation.

A method of hanging time control in thread

A time-controlled, threading technology, applied in the direction of multi-programming device, program startup/switching, creating/generating source code, etc., can solve the problems of thread blocking, inability to process other messages or transactions, etc., and achieve the effect of simple and reliable principle

Active Publication Date: 2019-05-17
THE 28TH RES INST OF CHINA ELECTRONICS TECH GROUP CORP
View PDF4 Cites 0 Cited by
  • Summary
  • Abstract
  • Description
  • Claims
  • Application Information

AI Technical Summary

Problems solved by technology

[0002] At this stage, multi-threading technology is widely used in software development. If time control (or timer) processing is required in the thread, it is basically using a blocking timing method similar to sleep, but in this blocking method, the thread is in Blocked state, unable to process other messages or transactions, the disadvantages are very obvious
If you hang the time control directly like a process, it is impossible for the thread to ensure that it can respond to the time signal (the SIGALRM signal is generally used under linux), and responding to these time signals in the thread will bring unpredictable Consequences, so there has not been an effective way to hang time control in a thread in a non-blocking manner

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
  • A method of hanging time control in thread
  • A method of hanging time control in thread
  • A method of hanging time control in thread

Examples

Experimental program
Comparison scheme
Effect test

Embodiment Construction

[0049] The present invention will be described in detail below in conjunction with the accompanying drawings. It should be noted that the described embodiments are for the purpose of illustration only, and do not limit the scope of the present invention.

[0050] to combine figure 1 — image 3 , the present invention includes the following processing steps:

[0051] Step 1, create a process time control queue timerList, hang the time control function setTimer_Thread, and time control response function timerFunction.

[0052] Each time control item in the time control queue timerList contains two time control attributes, the time control attribute one is used to indicate the thread ID, and the time control attribute two indicates the time attribute ID; in the timerList, each time control item arrives in sequence according to the time control Arranged sequentially.

[0053] The detailed data information stored in the time-controlled queue timerList is shown in Table 1:

[005...

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 proposes a method for setting a timer in a thread. The method comprises the steps of firstly, creating a process timer queue, a timer setting function and a process timer response function; secondly, creating sub-threads and message link tables interacting with a main thread, shielding timer signals in the sub-threads, and directly calling the timer setting function to set the timer when the timer needs to be set; thirdly, executing the process timer response function by the main thread in response to a time-up signal, converting a timer attribute of a thread into a timer message, and adding the timer message into the message link table of the corresponding thread; and finally, taking out the timer message by the thread to obtain the timer attribute, and performing corresponding timer processing according to the timer attribute.

Description

technical field [0001] The invention relates to a method for hanging time control (setting a timer), in particular to a method for hanging time control in a thread. Background technique [0002] At this stage, multi-threading technology is widely used in software development. If time control (or timer) processing is required in the thread, it is basically using a blocking timing method similar to sleep, but in this blocking method, the thread is in In the blocked state, other messages or transactions cannot be processed, and the disadvantages are very obvious. If you hang the time control directly like a process, it is impossible for the thread to ensure that it can respond to the time signal (the SIGALRM signal is generally used under linux), and responding to these time signals in the thread will bring unpredictable Consequences, so there has not been an effective way to hang time control in a thread in a non-blocking manner. Contents of the invention [0003] Purpose ...

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
Patent Type & Authority Patents(China)
IPC IPC(8): G06F9/48
CPCG06F8/30
Inventor 陈琛占怡王江伟王军刘兵姚芬黄志良孙裔申陶章志陈超沈海平
Owner THE 28TH RES INST OF CHINA ELECTRONICS TECH GROUP CORP