CN103179294B - Method for preventing task congestion in VOIP (voice over internet protocols) phone through thread pool - Google Patents

Method for preventing task congestion in VOIP (voice over internet protocols) phone through thread pool Download PDF

Info

Publication number
CN103179294B
CN103179294B CN201310077961.8A CN201310077961A CN103179294B CN 103179294 B CN103179294 B CN 103179294B CN 201310077961 A CN201310077961 A CN 201310077961A CN 103179294 B CN103179294 B CN 103179294B
Authority
CN
China
Prior art keywords
task
thread
phone
tasks
thread pool
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Expired - Fee Related
Application number
CN201310077961.8A
Other languages
Chinese (zh)
Other versions
CN103179294A (en
Inventor
石雨来
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Xiamen Yealink Network Technology Co Ltd
Original Assignee
Xiamen Yealink Network Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Xiamen Yealink Network Technology Co Ltd filed Critical Xiamen Yealink Network Technology Co Ltd
Priority to CN201310077961.8A priority Critical patent/CN103179294B/en
Publication of CN103179294A publication Critical patent/CN103179294A/en
Application granted granted Critical
Publication of CN103179294B publication Critical patent/CN103179294B/en
Expired - Fee Related legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Abstract

The invention provides a method for preventing task congestion in a VOIP (voice over internet protocols) phone through a thread pool. The method includes that: 1, a thread pool is started constructing by a phone, a preset number of threads are established in the thread pool, and each thread has a task queue; 2, a task virtual base class, including methods for executing tasks, reading tasks and writing tasks, is defined, and can store the pointers of calling classes in the phone; and each task inherits the corresponding task virtual base class; 3, when the phone is used, required tasks are established, established tasks are put into the thread pool, and are thrown to specified threads or any unoccupied general threads; if no unoccupied general thread exists, the tasks are thrown into the task queue of any general thread to be queued up; after any thread executes tasks, the tasks are called back by a callback function, and tidy ups are completed in a main thread. While the main thread of the phone is executed, some specified tasks can be executed asynchronously, and the task congestion in the VOIP phone is prevented.

Description

A kind of method being prevented task blocking in VOIP phone by thread pool
Technical field
The present invention relates to the technical field of communication apparatus, particularly relate to a kind of method being prevented task blocking in VOIP phone by thread pool.
Background technology
The networking telephone is also called VOIP phone, be landline telephone and the mobile phone of directly being dialed the other side by the Internet, comprise national distance and international long-distance, and rate is 10% to 20% of black phone expenses, macroscopically say and can be divided into soft phone and hardware phone.Soft phone is exactly download software on computers, then buys networking telephone card, is then conversed by headset realization and the other side's (fixed line or mobile phone); Hardware phone is relatively applicable to the use such as company, fixed telephone bar, and first want voice gateways, gateway is received on router, and another side is received on common phone, and then common phone can directly have been breathed out by network freedom.And existing in VOIP phone in can there is many tasks to be processed, conventional task is had in this task, also important task is had, then a main thread is often only had in VOIP phone, like this at main thread Processing tasks not in time, task important in phone will be caused to process timely, the experience effect of such client is just very poor, when such as user will carry out some subtasks such as download remote contact file or searching for contact persons, main thread due to now phone is busier cannot be processed in time, so just cannot long-range display contact person.
Summary of the invention
The technical problem to be solved in the present invention, is to provide a kind of method being prevented task blocking in VOIP phone by thread pool, solves because task in phone is too many, and main thread process does not come to cause the problem of task blocking in phone.
The present invention is achieved in that a kind of method being prevented task blocking in VOIP phone by thread pool, comprises the steps:
Step 1, VOIP phone start structure one thread pool, and in this thread pool, create the thread of predetermined amount, each thread has a task queue, for the queuing of task; Described thread comprises general thread and dedicated thread; This general thread is the thread that in phone, normal work to do all can share; This dedicated thread is the thread that in phone, vital task is used, for preventing the obstruction of vital task;
Step 2, define a task virtual base class, this task virtual base class comprises: execute the task, the method for reading task, writing task, and can preserve in phone the pointer calling class; In described phone, each task is all inherited from this task virtual base class;
When step 3, VOIP phone use, task needed for establishment, each task created is put into described thread pool, and thread pool throws to the general thread of dedicated thread or any free time, if leisureless general thread, then throw away at random in the task queue of any general thread and rank; After the complete task of any thread execution, adjusted back by call back function, in the main thread of phone, complete round-off work; Described call back function is the class using thread pool to execute the task, to realize the complete rear readjustment of tasks carrying.。
Further, described normal work to do comprises: various remote address book downloading task, ring signal file downloading task, file read-write task or search mission.
Further, described vital task comprises: LDAP contact person obtains task or local linkages people search mission.
Tool of the present invention has the following advantages:
1, the main thread of VOIP phone of the present invention is while operation, can some particular task of asynchronous operation, does not also affect main thread and runs.
2, by the application of dedicated thread in thread pool, specific vital task is not blocked.
3, use simply, only need succession one task virtual base class, realize call back function.
4, clear in structure, realize simple, be beneficial to expansion, any particular task only need inherit task virtual base class, realizes its specific method.
Accompanying drawing explanation
Fig. 1 is method flow schematic diagram of the present invention.
Embodiment
Refer to shown in Fig. 1, the present invention is a kind of method being prevented task blocking in VOIP phone by thread pool, comprises the steps:
Step 1, VOIP phone start structure one thread pool, and in this thread pool, create the thread of predetermined amount, each thread has a task queue, for the queuing of task; Described thread comprises general thread and dedicated thread; This general thread is the thread that in phone, normal work to do all can share; This dedicated thread is the thread that in phone, vital task is used, for preventing the obstruction of vital task;
Step 2, define a task virtual base class, this task virtual base class comprises: execute the task, the method for reading task (as search mission, downloading task etc.), writing task (as to server up transfer file task), and can preserve in phone the pointer calling class; In described phone, each task is all inherited from this task virtual base class; And the method realized in task virtual base class;
When step 3, VOIP phone use, task needed for establishment, each task created is put into described thread pool, and thread pool throws to the general thread of dedicated thread or any free time, if leisureless general thread, then throw away at random in the task queue of any general thread and rank; After the complete task of any thread execution, adjusted back by call back function, in the main thread of phone, complete round-off work; Described call back function is the class using thread pool to execute the task, and this Similar integral has the virtual base class of a pure virtual function (call back function), to realize the complete rear readjustment of tasks carrying.
In the present invention, described normal work to do comprises: various remote address book downloading task, ring signal file downloading task, file read-write task or search mission etc.Described vital task comprises: telephone directory LDAP contact person obtains task or local linkages people search mission etc. (can be self-defined according to concrete importance).
In a word, the main thread of VOIP phone of the present invention, can some particular task of asynchronous operation while operation, does not also affect main thread and runs.By the application of dedicated thread in thread pool, do not block specific vital task.And the present invention uses simply, only need succession one task virtual base class, realize call back function; Clear in structure of the present invention in addition, realize simple, be beneficial to expansion, any particular task only need inherit task virtual base class, realizes its specific method.
Although the foregoing describe the specific embodiment of the present invention; but be familiar with those skilled in the art to be to be understood that; specific embodiment described by us is illustrative; instead of for the restriction to scope of the present invention; those of ordinary skill in the art, in the modification of the equivalence done according to spirit of the present invention and change, should be encompassed in scope that claim of the present invention protects.

Claims (3)

1. prevented a method for task blocking in VOIP phone by thread pool, it is characterized in that, comprise the steps:
Step 1, VOIP phone start structure one thread pool, and in this thread pool, create the thread of predetermined amount, each thread has a task queue, for the queuing of task; Described thread comprises general thread and dedicated thread; This general thread is the thread that in phone, normal work to do all can share; This dedicated thread is the thread that in phone, vital task is used, for preventing the obstruction of vital task;
Step 2, define a task virtual base class, this task virtual base class comprises: execute the task, the method for reading task, writing task, and can preserve in phone the pointer calling class; In described phone, each task is all inherited from this task virtual base class;
When step 3, VOIP phone use, task needed for establishment, each task created is put into described thread pool, and thread pool throws to the general thread of dedicated thread or any free time, if leisureless general thread, then throw away at random in the task queue of any general thread and rank; After the complete task of any thread execution, adjusted back by call back function, in the main thread of phone, complete round-off work; Described call back function is the class using thread pool to execute the task, to realize the complete rear readjustment of tasks carrying.
2. a kind of method being prevented task blocking in VOIP phone by thread pool according to claim 1, be is characterized in that: described normal work to do comprises: various remote address book downloading task, ring signal file downloading task, file read-write task or search mission.
3. a kind of method being prevented task blocking in VOIP phone by thread pool according to claim 1, be is characterized in that: described vital task comprises: telephone directory LDAP contact person obtains task or local linkages people search mission.
CN201310077961.8A 2013-03-12 2013-03-12 Method for preventing task congestion in VOIP (voice over internet protocols) phone through thread pool Expired - Fee Related CN103179294B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201310077961.8A CN103179294B (en) 2013-03-12 2013-03-12 Method for preventing task congestion in VOIP (voice over internet protocols) phone through thread pool

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201310077961.8A CN103179294B (en) 2013-03-12 2013-03-12 Method for preventing task congestion in VOIP (voice over internet protocols) phone through thread pool

Publications (2)

Publication Number Publication Date
CN103179294A CN103179294A (en) 2013-06-26
CN103179294B true CN103179294B (en) 2015-04-08

Family

ID=48638904

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201310077961.8A Expired - Fee Related CN103179294B (en) 2013-03-12 2013-03-12 Method for preventing task congestion in VOIP (voice over internet protocols) phone through thread pool

Country Status (1)

Country Link
CN (1) CN103179294B (en)

Families Citing this family (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN105975250A (en) * 2016-04-27 2016-09-28 乐视控股(北京)有限公司 Quick charging command processing method and device used for electronic equipment, and electronic equipment
CN108920275A (en) * 2018-06-25 2018-11-30 郑州云海信息技术有限公司 A kind of method, apparatus, equipment and computer storage medium grabbing black box log
CN110417912B (en) * 2019-08-08 2022-01-28 成都九洲电子信息系统股份有限公司 Method for calling back after file downloading is completed
CN114079698A (en) * 2020-08-12 2022-02-22 北京有限元科技有限公司 Method and device for polling intelligent outbound robot and storage medium

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1423456A (en) * 2001-12-03 2003-06-11 深圳市中兴通讯股份有限公司上海第二研究所 Sharing route realizing and sheduling method
US6604125B1 (en) * 1999-09-24 2003-08-05 Sun Microsystems, Inc. Mechanism for enabling a thread unaware or non thread safe application to be executed safely in a multi-threaded environment
CN101777008A (en) * 2009-12-31 2010-07-14 中兴通讯股份有限公司 Method and device for realizing mobile terminal system thread pool
CN102541653A (en) * 2010-12-24 2012-07-04 新奥特(北京)视频技术有限公司 Method and system for scheduling multitasking thread pools
CN102760082A (en) * 2011-04-29 2012-10-31 腾讯科技(深圳)有限公司 Method for managing task and mobile terminal

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US6604125B1 (en) * 1999-09-24 2003-08-05 Sun Microsystems, Inc. Mechanism for enabling a thread unaware or non thread safe application to be executed safely in a multi-threaded environment
CN1423456A (en) * 2001-12-03 2003-06-11 深圳市中兴通讯股份有限公司上海第二研究所 Sharing route realizing and sheduling method
CN101777008A (en) * 2009-12-31 2010-07-14 中兴通讯股份有限公司 Method and device for realizing mobile terminal system thread pool
CN102541653A (en) * 2010-12-24 2012-07-04 新奥特(北京)视频技术有限公司 Method and system for scheduling multitasking thread pools
CN102760082A (en) * 2011-04-29 2012-10-31 腾讯科技(深圳)有限公司 Method for managing task and mobile terminal

Also Published As

Publication number Publication date
CN103179294A (en) 2013-06-26

Similar Documents

Publication Publication Date Title
KR102238205B1 (en) Apparatus and method for maintaining a message thread with opt-in permanence for entries
TW201915701A (en) Message display method and device
CN103179294B (en) Method for preventing task congestion in VOIP (voice over internet protocols) phone through thread pool
US20150350126A1 (en) Method and device for using log information
JP2015508973A (en) Method and device for processing contacts and mobile terminal
US8582733B1 (en) Phone system with methodology for call parking
WO2014117573A1 (en) Method and apparatus for clearing notification icon, and storage medium
WO2017032038A1 (en) Alarm clock setting method and terminal
CN105468235B (en) Management method, device and the terminal of user session window
US9906471B1 (en) System, device, and method for managing composition of electronic messages using temporary suspensions
CN105450768A (en) Reservation sequencing method and reservation sequencing apparatus
US8929867B2 (en) Automated electronic messaging to a person with whom another form of communication is exchanged
EP3482304A1 (en) Concept-based search and categorization
US20170279755A1 (en) Augmenting location of social media posts based on proximity of other posts
US20130030682A1 (en) Identification of a person located proximite to a contact identified in an electronic communication client
US20180041632A1 (en) Customizable presence-based recipient available notification
US11503160B2 (en) System and method for mobile device active callback integration
WO2021143232A1 (en) Message scheduling method and apparatus, and storage medium and electronic device
US20170041283A1 (en) Prioritizing and handling of messages across multiple communication systems
US8553860B1 (en) Auto-save, retrieval, and presentation of key press sequences
US11029809B2 (en) System for displaying electronic mail metadata and related methods
AU2016341442A1 (en) Intelligent subscriber profile control and management
WO2020205962A1 (en) A system and method for mobile device active callback integration
CN105262906B (en) A kind of processing method and processing device notifying the tinkle of bells
US11665283B2 (en) System and method for mobile device active callback integration

Legal Events

Date Code Title Description
C06 Publication
PB01 Publication
C10 Entry into substantive examination
SE01 Entry into force of request for substantive examination
C14 Grant of patent or utility model
GR01 Patent grant
CF01 Termination of patent right due to non-payment of annual fee

Granted publication date: 20150408

CF01 Termination of patent right due to non-payment of annual fee