Signal processing method and device, electronic equipment and storage medium

By running the first and second threads in parallel in the WebAssembly application and using intermediate functions to achieve signal synchronization, the problem of not being able to respond to signals initiated by the operating system or hardware in a timely manner is solved, ensuring that signal processing does not interrupt the application and achieving timely response of the signal mechanism.

CN120704904APending Publication Date: 2025-09-26BEIJING XIAOMI MOBILE SOFTWARE CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202410345774.1
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-03-25
Publication Date
2025-09-26

AI Technical Summary

Technical Problem

Applications developed based on the WebAssembly standard library cannot respond to signals initiated by the operating system or hardware in a timely manner, resulting in limited signal processing capabilities.

Method used

A first thread and a second thread are run in parallel in an application, the first thread is used to run a preset application, and the second thread is used to execute a preset function; signals are processed by the second thread, and an intermediate function is registered in the operating system to achieve signal synchronization, ensuring that signal processing does not interrupt the operation of the application.

Benefits of technology

This enables timely responses to signals generated by the operating system or within the application in WebAssembly applications, meeting the requirements of the signal mechanism without affecting the normal operation of the application.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120704904A_ABST
    Figure CN120704904A_ABST
Patent Text Reader

Abstract

The invention relates to a signal processing method and device, electronic equipment and a storage medium. The signal processing method comprises the following steps: receiving a starting instruction of a preset application program; a first thread and a second thread are run, the first thread is used for running a preset application program, and the second thread is used for executing a preset function in the running process of the preset application program; when the second thread receives the first signal, the first signal is processed through the second thread, and the first signal represents a communication mode with the preset application program process. According to the method, the signal can be responded in time, it can be ensured that operation of the application program is not affected when the signal is processed, a signal mechanism can be achieved in the WebAssembly application program, and the requirement of the application program for the signal mechanism is met.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present disclosure relates to the field of computer technology, and in particular to a signal processing method, device, electronic device, and storage medium. Background Art

[0002] WebAssembly, an assembly-like language that serves as a compilation target for other programming languages, provides a secure and portable runtime environment for lightweight devices. Its application is growing in areas such as website development, mobile development, and system programming. However, signal processing in applications developed based on the WebAssembly standard library has certain limitations, making it difficult to respond to signals initiated by the operating system or hardware in a timely manner. Summary of the Invention

[0003] To overcome the problems existing in the related art, the present disclosure provides a signal processing method, device, electronic device and storage medium.

[0004] According to a first aspect of an embodiment of the present disclosure, a signal processing method is provided, the method comprising:

[0005] Receive a command to start a preset application;

[0006] Running a first thread and a second thread, wherein the first thread is used to run the preset application, and the second thread is used to execute a preset function during the running of the preset application;

[0007] When the second thread receives the first signal, the second thread processes the first signal, where the first signal represents a communication method with the preset application process.

[0008] In an exemplary embodiment, the method further comprises:

[0009] registering a plurality of preset functions in the preset application, wherein the plurality of preset functions respectively process different types of signals;

[0010] Based on the multiple preset functions, an intermediate function is registered in the operating system, where the intermediate function represents a system representation of the multiple preset functions.

[0011] In an exemplary embodiment, the method further comprises:

[0012] When the operating system generates the first signal, the first signal is sent to the second thread through the intermediate function.

[0013] In an exemplary embodiment, processing the first signal by the second thread includes:

[0014] determining a target function from the plurality of preset functions according to the type of the first signal;

[0015] In the second thread, the target function is called to process the first signal.

[0016] In an exemplary embodiment, the method further comprises:

[0017] When the first thread generates the first signal, the first signal is sent to the second thread through the first thread.

[0018] In an exemplary embodiment, sending the first signal to the second thread includes:

[0019] Sending the first signal to the second thread by at least one of the following inter-process synchronization methods:

[0020] Semaphores, pipes, message queues, shared memory.

[0021] In an exemplary embodiment, the method further comprises:

[0022] When the first thread generates a second signal, the second signal is sent to the operating system, and the operating system processes the second signal, where the second signal represents a communication method with the operating system process.

[0023] According to a second aspect of an embodiment of the present disclosure, there is provided a signal processing device, the device comprising:

[0024] A receiving module is configured to receive an opening instruction of a preset application program;

[0025] an operating module configured to operate a first thread and a second thread, wherein the first thread is used to operate the preset application, and the second thread is used to execute a preset function during the operation of the preset application;

[0026] The processing module is configured to process the first signal through the second thread when the second thread receives the first signal, where the first signal represents a communication method with the preset application process.

[0027] According to a third aspect of an embodiment of the present disclosure, there is provided an electronic device, including:

[0028] processor;

[0029] a memory for storing processor-executable instructions;

[0030] The processor is configured to execute the method as described in the first aspect of the embodiment of the present disclosure.

[0031] According to a fourth aspect of an embodiment of the present disclosure, a non-temporary computer-readable storage medium is provided, which, when instructions in the storage medium are executed by a processor of an electronic device, enables the electronic device to execute the method described in the first aspect of the embodiment of the present disclosure.

[0032] The above-mentioned method disclosed in the present invention has the following beneficial effects: when a start instruction of a preset application is received, the first thread and the second thread are run in parallel, the first thread is used to run the preset application, and the second thread is used to execute a preset function during the running process of the preset application, which can ensure that when the preset function needs to be executed, there is no need to interrupt the running process of the application. When the second thread receives the first signal, the first signal is processed by the second thread, and the signal can be responded to in time, so as to implement the signal mechanism in the WebAssembly application and meet the application's requirements for the signal mechanism.

[0033] It is to be understood that the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the disclosure. BRIEF DESCRIPTION OF THE DRAWINGS

[0034] The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the present disclosure and, together with the description, serve to explain the principles of the present disclosure.

[0035] Figure 1 is a flowchart of a signal processing method according to an exemplary embodiment;

[0036] Figure 2 is a flowchart of a signal processing method according to an exemplary embodiment;

[0037] Figure 3 is a flowchart of a signal processing method according to an exemplary embodiment;

[0038] Figure 4 is a flowchart of a signal processing method according to an exemplary embodiment;

[0039] Figure 5 is a block diagram of a signal processing device according to an exemplary embodiment;

[0040] Figure 6 It is a block diagram of an electronic device according to an exemplary embodiment. DETAILED DESCRIPTION

[0041] Exemplary embodiments will be described in detail herein, with examples illustrated in the accompanying drawings. In the following description, when referring to the drawings, identical numerals in different figures represent identical or similar elements, unless otherwise indicated. The embodiments described in the following exemplary embodiments are not intended to represent all possible embodiments consistent with the present disclosure. Rather, they are merely examples of apparatus and methods consistent with certain aspects of the present disclosure, as detailed in the appended claims.

[0042] In some embodiments, wasi-libc serves as the standard library of WebAssembly. When developing applications, it is usually developed based on the standard library. The functions used to simulate the signal processing process in the standard library include the signal function and the raise function. The signal function is used to register the signal processing function and save the signal processing function in a global variable. The raise function is used to call the signal processing function saved in the global variable and process the signal through the signal processing function.

[0043] However, in reality, signals initiated by the operating system or hardware will interrupt the execution of the application, and then call the signal processing function to handle the signal. In applications developed based on the WebAssembly standard library, the signal processing function is executed in the application. Due to the characteristics of the stack virtual machine of WebAssembly itself, the signal processing function cannot obtain the context information when the signal occurs, such as the stack frame information when the signal occurs, the register information when the signal occurs, etc., resulting in the inability to interrupt the execution of the application through the calling interface of the virtual machine on the operating system side. Therefore, it is also impossible to directly call the signal processing function to handle the signal at this time. In addition, the signal processing function can only be called when the application calls the raise function. If the application does not call the raise function when the signal is generated, the signal processing function cannot be called in time to process the signal. It is necessary to wait for the application to run until the raise function is called, so it is impossible to respond to the signal in time.

[0044] In an exemplary embodiment of the present disclosure, to overcome the problem of related art inability to respond to signals in a timely manner, a signal processing method is provided, including: receiving a command to launch a preset application; running a first thread and a second thread, the first thread being used to run the preset application, and the second thread being used to execute a preset function during the running of the preset application; when the second thread receives a first signal, the second thread processes the first signal, the first signal representing a communication method with the preset application process. This method can respond to signals in a timely manner and ensures that signal processing does not affect the running of the application. It can also implement a signal mechanism in a WebAssembly application, meeting the application's signal mechanism requirements.

[0045] In an exemplary embodiment of the present disclosure, a signal processing method is provided. Figure 1 is a flow chart showing a signal processing method according to an exemplary embodiment. Figure 1 As shown, the following steps are included:

[0046] Step S101, receiving a command to start a preset application;

[0047] Step S102: running a first thread and a second thread, wherein the first thread is used to run a preset application, and the second thread is used to execute a preset function during the running of the preset application;

[0048] Step S103: When the second thread receives the first signal, the second thread processes the first signal, where the first signal represents a communication method with a preset application process.

[0049] The signal processing method in the embodiments of the present disclosure is applied to electronic devices, including smart phones, tablets, personal computers, smart devices, smart wearable devices and other electronic devices.

[0050] In step S101, the pre-set application represents an application developed based on WebAssembly that needs to receive and process signals generated by the electronic device's operating system, such as a system-level application or a hardware driver application that requires active notification from the operating system. The pre-set application launch instruction can be a user clicking on the application icon, or it can be issued by the operating system when it detects that the automatic launch conditions are met.

[0051] In step S102, when the start instruction is received, the process of the preset application is started, and the first thread and the second thread are run at the same time. The first thread and the second thread run in parallel. The first thread is used to run the preset application and is the main thread. The second thread is used to execute a preset function during the running process of the preset application. The preset function can be called a signal processing function or an interrupt function. The preset function is used to process signals.

[0052] In step S103, the first signal represents the communication method with the preset application process, and is used to notify the preset application process of events that have occurred. The first signal is a simulation of an interrupt at the software level. The first signal can come from hardware or an operating system, such as keyboard input or hardware failure, or it can come from the first thread, such as a raise function or an illegal operation. The first signal is recorded as signal, including signals SIGINT, SIGTERM, SIGKILL, etc. When the second thread is running, it always waits for the first signal. When the second thread receives the first signal, it calls the preset function in the second thread to process the current first signal. After the processing of the current first signal is completed, it continues to wait for the subsequent first signal. Processing the first signal in the second thread will not affect the operation of the preset application in the first thread.

[0053] In an exemplary embodiment of the present disclosure, upon receiving a command to start a preset application, a first thread and a second thread are run in parallel. The first thread is used to run the preset application, and the second thread is used to execute a preset function during the running of the preset application. This ensures that the running process of the application does not need to be interrupted when the preset function needs to be executed. When the second thread receives a first signal, it processes the first signal through the second thread and can respond to the signal in a timely manner. This method can implement a signal mechanism in applications developed based on WebAssembly, respond to signals generated by the operating system or within the application in a timely manner, meet the application's requirements for a signal mechanism, and ensure that signal processing does not affect the operation of the application.

[0054] In an exemplary embodiment of the present disclosure, a signal processing method is provided. Figure 2 is a flow chart showing a signal processing method according to an exemplary embodiment. Figure 2 As shown, the following steps are included:

[0055] Step S201, receiving a command to start a preset application;

[0056] Step S202: running a first thread and a second thread, wherein the first thread is used to run a preset application, and the second thread is used to execute a preset function during the running of the preset application;

[0057] Step S203, registering multiple preset functions in a preset application, wherein the multiple preset functions process different types of signals respectively;

[0058] Step S204: registering an intermediate function in the operating system based on the multiple preset functions, where the intermediate function represents a system representation of the multiple preset functions;

[0059] Step S205: When the operating system generates a first signal, the first signal is sent to the second thread through the intermediate function;

[0060] Step S206: When the second thread receives the first signal, the second thread determines a target function from a plurality of preset functions according to the type of the first signal;

[0061] Step S207: In the second thread, call the target function to process the first signal.

[0062] The specific implementation of steps S201 and S202 refers to steps S101 and S102 and will not be repeated here.

[0063] In step S203, when the preset application is running, the signal function is called to register multiple preset functions for processing different types of signals respectively. Each time a preset function is registered, a unique identification symbol is added to it and saved in a global array. For example, when the preset function is a signal processing function, a unique identification symbol is added to each signal processing function through the subscript. The signal processing function with a subscript of 0 in the array is used to process the signal SIGINT, the signal processing function with a subscript of 1 in the array is used to process the signal SIGTERM, and the signal processing function with a subscript of 2 in the array is used to process the signal SIGKILL. Since the registered preset functions are saved in the global array, the thread that executes the registered preset function does not affect the call of the preset function. Therefore, multiple preset functions can be registered by calling the signal function through the first thread, and multiple preset functions can also be registered by calling the signal function through the second thread.

[0064] In step S204, since the operating system cannot directly call the preset function registered in the preset application, a function for processing the signal must be registered in the operating system for the operating system to call. Furthermore, since the preset application cannot register the preset function with the operating system, the first thread or the second thread calls a system interface to register an intermediate function in the operating system. The intermediate function is a representation of the preset function in the operating system, and is a simplified form of the preset function. For example, an intermediate function is registered in the Linux operating system by calling the sigaction function.

[0065] In step S205, when the operating system generates a first signal according to a user-defined instruction, or generates a first signal according to the system operating status, the operating system sends the first signal to the second thread by calling an intermediate function. Since the operating system and the preset application belong to different processes, an inter-process synchronization method is required to send the first signal to the second thread.

[0066] In some implementations, the first signal is sent to the second thread via at least one of the following inter-process synchronization methods: a semaphore, a pipe, a message queue, or a shared memory.

[0067] In one example, when synchronization is performed through a semaphore, the operating system calls an intermediate function, and the intermediate function releases the semaphore to notify the second thread that there is a signal that needs to be processed; when synchronization is performed through a pipe, the operating system calls the intermediate function to write the first signal to the write end of the pipe (i.e., the write end).

[0068] In step S206, when the second thread receives the first signal sent by the operating system, a target function is determined from multiple preset functions in the global array according to the type of the first signal and the signal type processed by each preset function. The target function is used to process the first signal.

[0069] In some implementations, the second thread receives the first signal through at least one of the following inter-process synchronization methods: a semaphore, a pipe, a message queue, and a shared memory.

[0070] In one example, when synchronization is performed through a semaphore, the second thread waits for the semaphore, and after the intermediate function releases the semaphore, the second thread can receive the first signal; when synchronization is performed through a pipe, the second thread reads the signal from the reading end of the pipe (i.e., the read end), and after the intermediate function writes the first signal to the writing end of the pipe, the second thread can read the first signal.

[0071] In step S207, in the second thread, the first signal is processed by calling the target function, which will not affect the operation of the first thread. After processing the current first signal, it continues to wait for the subsequent first signal, for example, continues to wait for the semaphore, or continues to read the signal from the pipeline.

[0072] In one example, the second thread is recorded as thread irq_thread, the semaphore is recorded as semaphore irq_sync, the preset function is the signal processing function, the operating system calls the intermediate function to release the semaphore irq_sync, and notifies the second thread that there is a signal to be processed. The thread irq_thread calls the signal processing function to process the first signal. At this time, the execution of the signal processing function will not affect the operation of the preset application. After processing the current first signal, it continues to wait for the semaphore irq_sync and wait for the next first signal.

[0073] In this embodiment, by registering an intermediate function in the operating system, the signal generated by the operating system is synchronized to the preset application process by calling the intermediate function, and the signal processing process is executed by the second thread without affecting the operation of the preset application, so that a timely response can be made to the signal generated by the operating system.

[0074] In an exemplary embodiment of the present disclosure, a signal processing method is provided. Figure 3 is a flow chart showing a signal processing method according to an exemplary embodiment. Figure 3 As shown, the following steps are included:

[0075] Step S301, receiving a command to start a preset application;

[0076] Step S302: running a first thread and a second thread, wherein the first thread is used to run a preset application, and the second thread is used to execute a preset function during the running of the preset application;

[0077] Step S303, registering multiple preset functions in a preset application, wherein the multiple preset functions process different types of signals respectively;

[0078] Step S304: When the first thread generates a first signal, the first signal is sent to the second thread through the first thread;

[0079] Step S305: When the second thread receives the first signal, a target function is determined from a plurality of preset functions according to the type of the first signal;

[0080] Step S306: In the second thread, call the target function to process the first signal.

[0081] The specific implementation of steps S301 to S303 refers to steps S201 to S203 , and the specific implementation of steps S305 to S306 refers to steps S206 to S207 , which will not be repeated here.

[0082] In step S304, when the first thread generates a first signal according to a user-defined instruction, or generates a first signal due to an illegal operation occurring during the execution of a preset application, or generates a first signal due to other reasons within the preset application, the first thread calls the raise function to send the first signal to the second thread.

[0083] In one example, the first thread calls the raise function to release the semaphore irq_sync, and the second thread waits for the semaphore. When the second thread detects the semaphore irq_sync, it calls a preset function to process the first signal.

[0084] In another example, the first thread writes the first signal into the message queue, and the second thread reads the signal from the message queue. When the second thread reads the first signal from the message queue, it calls a preset function to process the first signal.

[0085] In this embodiment, when the application is running, a timely response can be made to the first signal generated within the preset application.

[0086] In an exemplary embodiment of the present disclosure, a signal processing method is provided. Figure 4 is a flow chart showing a signal processing method according to an exemplary embodiment. Figure 4 As shown, the following steps are included:

[0087] Step S401, receiving a command to start a preset application;

[0088] Step S402: running a first thread and a second thread, wherein the first thread is used to run a preset application, and the second thread is used to execute a preset function during the running of the preset application;

[0089] Step S403: When the second thread receives the first signal, the second thread processes the first signal, where the first signal represents an inter-process communication mode.

[0090] Step S404: When the first thread generates a second signal, the second signal is sent to the operating system, and the operating system processes the second signal. The second signal represents a communication method with the operating system process.

[0091] The specific implementation of steps S401 to S403 refers to steps S101 to S103 and will not be repeated here. They may also be replaced by steps S201 to S206 or steps S301 to S306 to form a new embodiment.

[0092] In step S404, a second signal represents a communication method with the operating system process, used to notify the operating system process of an event occurring within the preset application process. The second signal is generated by the first thread, for example, by a user-defined instruction during the execution of the preset application, or by an illegal operation occurring during the execution of the preset application. The first thread sends the second signal to the operating system by calling a system interface. Upon receiving the second signal, the operating system processes the second signal by calling a signal processing function within the operating system.

[0093] In this embodiment, the second signal can be synchronized to the operating system by calling the system interface, thereby realizing a signal interaction mechanism between the preset application program and the operating system.

[0094] In an exemplary embodiment of the present disclosure, a signal processing device is provided. Figure 5 is a block diagram of a signal processing device according to an exemplary embodiment. Figure 5 As shown, the signal processing device includes:

[0095] The receiving module 501 is configured to receive an instruction to start a preset application program;

[0096] The running module 502 is configured to run a first thread and a second thread, wherein the first thread is used to run the preset application, and the second thread is used to execute a preset function during the running of the preset application;

[0097] The processing module 503 is configured to process the first signal through the second thread when the second thread receives the first signal, where the first signal represents a communication method with the preset application process.

[0098] In an exemplary embodiment, the signal processing apparatus further includes a registration module 504 configured to:

[0099] registering a plurality of preset functions in the preset application, wherein the plurality of preset functions respectively process different types of signals;

[0100] Based on the multiple preset functions, an intermediate function is registered in the operating system, where the intermediate function represents a system representation of the multiple preset functions.

[0101] In an exemplary embodiment, the signal processing apparatus further includes a synchronization module 505 configured to:

[0102] When the operating system generates the first signal, the first signal is sent to the second thread through the intermediate function.

[0103] In an exemplary embodiment, the processing module 503 is further configured to:

[0104] determining a target function from the plurality of preset functions according to the type of the first signal;

[0105] In the second thread, the target function is called to process the first signal.

[0106] In an exemplary embodiment, the synchronization module 505 is further configured to:

[0107] When the first thread generates the first signal, the first signal is sent to the second thread through the first thread.

[0108] In an exemplary embodiment, the synchronization module 505 is further configured to:

[0109] Sending the first signal to the second thread by at least one of the following inter-process synchronization methods:

[0110] Semaphores, pipes, message queues, shared memory.

[0111] In an exemplary embodiment, the synchronization module 505 is further configured to:

[0112] When the first thread generates a second signal, the second signal is sent to the operating system, and the operating system processes the second signal, where the second signal represents a communication method with the operating system process.

[0113] Regarding the apparatus in the above embodiment, the specific manner in which each module performs operations has been described in detail in the embodiment of the method, and will not be elaborated here.

[0114] Figure 6 is a block diagram of an electronic device 600 according to an exemplary embodiment.

[0115] Reference Figure 6 , the electronic device 600 may include one or more of the following components: a processing component 602 , a memory 604 , a power component 606 , a multimedia component 608 , an audio component 610 , an input / output (I / O) interface 612 , a sensor component 614 , and a communication component 616 .

[0116] The processing component 602 generally controls the overall operation of the electronic device 600, such as operations associated with display, phone calls, data communications, camera operation, and recording operations. The processing component 602 may include one or more processors 620 to execute instructions to perform all or part of the steps of the above-described method. In addition, the processing component 602 may include one or more modules to facilitate interaction between the processing component 602 and other components. For example, the processing component 602 may include a multimedia module to facilitate interaction between the multimedia component 608 and the processing component 602.

[0117] The memory 604 is configured to store various types of data to support operations on the electronic device 600. Examples of such data include instructions for any application or method operating on the electronic device 600, contact data, phone book data, messages, pictures, videos, etc. The memory 604 can be implemented by any type of volatile or non-volatile storage device or a combination thereof, such as static random access memory (SRAM), electrically erasable programmable read-only memory (EEPROM), erasable programmable read-only memory (EPROM), programmable read-only memory (PROM), read-only memory (ROM), magnetic memory, flash memory, magnetic disk, or optical disk.

[0118] The power supply assembly 606 provides power to the various components of the electronic device 600. The power supply assembly 606 may include a power management system, one or more power supplies, and other components associated with generating, managing, and distributing power to the electronic device 600.

[0119] The multimedia component 608 includes a screen that provides an output interface between the electronic device 600 and the user. In some embodiments, the screen may include a liquid crystal display (LCD) and a touch panel (TP). If the screen includes a touch panel, the screen may be implemented as a touch screen to receive input signals from the user. The touch panel includes one or more touch sensors to sense touches, slides, and gestures on the touch panel. The touch sensor can not only sense the boundaries of the touch or slide action, but also detect the duration and pressure associated with the touch or slide operation. In some embodiments, the multimedia component 608 includes a front camera and / or a rear camera. When the electronic device 600 is in an operating mode, such as a shooting mode or a video mode, the front camera and / or the rear camera can receive external multimedia data. Each front camera and rear camera can be a fixed optical lens system or have a focal length and optical zoom capability.

[0120] The audio component 610 is configured to output and / or input audio signals. For example, the audio component 610 includes a microphone (MIC), which is configured to receive external audio signals when the electronic device 600 is in an operating mode, such as a call mode, a recording mode, and a voice recognition mode. The received audio signal can be further stored in the memory 604 or transmitted via the communication component 616. In some embodiments, the audio component 610 also includes a speaker for outputting audio signals.

[0121] I / O interface 612 provides an interface between processing component 602 and peripheral interface modules, such as a keyboard, click wheel, buttons, etc. These buttons may include but are not limited to: a home button, volume buttons, a start button, and a lock button.

[0122] The sensor assembly 614 includes one or more sensors for providing various aspects of status assessment for the electronic device 600. For example, the sensor assembly 614 can detect the open / closed state of the electronic device 600, the relative positioning of components, such as the display and keypad of the electronic device 600. The sensor assembly 614 can also detect changes in the position of the electronic device 600 or a component of the electronic device 600, the presence or absence of user contact with the electronic device 600, the orientation or acceleration / deceleration of the electronic device 600, and temperature changes of the electronic device 600. The sensor assembly 614 may include a proximity sensor configured to detect the presence of nearby objects without any physical contact. The sensor assembly 614 may also include a light sensor, such as a CMOS or CCD image sensor, for use in imaging applications. In some embodiments, the sensor assembly 614 may also include an accelerometer, a gyroscope sensor, a magnetic sensor, a pressure sensor, or a temperature sensor.

[0123] The communication component 616 is configured to facilitate wired or wireless communication between the electronic device 600 and other devices. The electronic device 600 can access a wireless network based on a communication standard, such as WiFi, 2G or 3G, or a combination thereof. In an exemplary embodiment, the communication component 616 receives a broadcast signal or broadcast-related information from an external broadcast management system via a broadcast channel. In an exemplary embodiment, the communication component 616 also includes a near field communication (NFC) module to facilitate short-range communication. For example, the NFC module can be implemented based on radio frequency identification (RFID) technology, infrared data association (IrDA) technology, ultra-wideband (UWB) technology, Bluetooth (BT) technology and other technologies.

[0124] In an exemplary embodiment, the electronic device 600 may be implemented by one or more application-specific integrated circuits (ASICs), digital signal processors (DSPs), digital signal processing devices (DSPDs), programmable logic devices (PLDs), field programmable gate arrays (FPGAs), controllers, microcontrollers, microprocessors, or other electronic components to perform the above methods.

[0125] In an exemplary embodiment, a non-transitory computer-readable storage medium including instructions is also provided, such as a memory 604 including instructions, and the instructions can be executed by the processor 620 of the electronic device 600 to perform the above method. For example, the non-transitory computer-readable storage medium can be a ROM, a random access memory (RAM), a CD-ROM, a magnetic tape, a floppy disk, an optical data storage device, etc.

[0126] A non-transitory computer-readable storage medium enables the electronic device to perform a signal processing method when instructions in the storage medium are executed by a processor of the electronic device.

[0127] Other embodiments of the present disclosure will readily occur to those skilled in the art after considering the specification and practicing the invention disclosed herein. This application is intended to cover any variations, uses, or adaptations of the present disclosure that follow the general principles of the present disclosure and include common knowledge or customary techniques in the art not disclosed herein. The description and examples are to be considered as exemplary only, with the true scope and spirit of the present disclosure being indicated by the following claims.

[0128] It should be understood that the present disclosure is not limited to the exact structures that have been described above and shown in the drawings, and that various modifications and changes can be made without departing from the scope thereof. The scope of the present disclosure is limited only by the appended claims.

Claims

1. A signal processing method, characterized in that: The method comprises: Receive a command to start a preset application; Running a first thread and a second thread, wherein the first thread is used to run the preset application, and the second thread is used to execute a preset function during the running of the preset application; When the second thread receives the first signal, the second thread processes the first signal, where the first signal represents a communication method with the preset application process.

2. The signal processing method according to claim 1, wherein: The method further comprises: registering a plurality of preset functions in the preset application, wherein the plurality of preset functions respectively process different types of signals; Based on the multiple preset functions, an intermediate function is registered in the operating system, where the intermediate function represents a system representation of the multiple preset functions.

3. The signal processing method according to claim 2, wherein: The method further comprises: When the operating system generates the first signal, the first signal is sent to the second thread through the intermediate function.

4. The signal processing method according to claim 2, wherein: The processing of the first signal by the second thread includes: determining a target function from the plurality of preset functions according to the type of the first signal; In the second thread, the target function is called to process the first signal.

5. The signal processing method according to claim 1, wherein: The method further comprises: When the first thread generates the first signal, the first signal is sent to the second thread through the first thread.

6. The signal processing method according to claim 3 or 5, characterized in that: The sending the first signal to the second thread includes: Sending the first signal to the second thread by at least one of the following inter-process synchronization methods: Semaphores, pipes, message queues, shared memory.

7. The signal processing method according to claim 1, wherein: The method further comprises: When the first thread generates a second signal, the second signal is sent to the operating system, and the operating system processes the second signal, where the second signal represents a communication method with the operating system process.

8. A signal processing device, characterized in that: The device comprises: A receiving module is configured to receive an opening instruction of a preset application program; an operating module configured to operate a first thread and a second thread, wherein the first thread is used to operate the preset application, and the second thread is used to execute a preset function during the operation of the preset application; The processing module is configured to process the first signal through the second thread when the second thread receives the first signal, where the first signal represents a communication method with the preset application process.

9. An electronic device, characterized in that: include: processor; a memory for storing processor-executable instructions; The processor is configured to execute the method according to any one of claims 1 to 7.

10. A non-transitory computer-readable storage medium, characterized in that When the instructions in the storage medium are executed by a processor of an electronic device, the electronic device is enabled to execute the method according to any one of claims 1 to 7.