Overtime event processing method and device, vehicle, equipment and storage medium

By adopting a single-level time round design and effective identification bit management in timeout event processing, the problems of complexity and large memory usage of multi-level time round in the prior art are solved, and efficient and reliable timeout event processing is achieved.

CN119440876APending Publication Date: 2025-02-14GUOKE FOUNDATION STONE (CHONGQING) SOFTWARE CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411510814.X
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Priority Date
2024-07-17
Filing Date
2024-10-28
Publication Date
2025-02-14

AI Technical Summary

Technical Problem

In the existing timeout event processing methods, the multi-level time round design is complex and occupies a large amount of dynamic memory, resulting in low processing efficiency and poor reliability.

Method used

Using a single-level time wheel design, the target time wheel node and time threshold are calculated by detecting the time information and callback function of the time-out event, and the time-out event is registered with the target time wheel node, and when the time wheel rotates to the target node, it is based on the effective The identification bit and time threshold determine whether the callback conditions are met, and the callback function is called for processing.

Benefits of technology

It reduces dynamic memory usage and program complexity, improves the efficiency and reliability of timeout event processing, and realizes rapid positioning and unified processing of timeout information.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119440876A_ABST
    Figure CN119440876A_ABST
Patent Text Reader

Abstract

The invention relates to a timeout event processing method and device, a vehicle, equipment and a storage medium, and the method comprises the steps: detecting that a timeout event occurs at a current time wheel node, the timeout event carries time information and a callback function, calculating a target time wheel node and a time threshold value of the timeout event according to the time information and the current time wheel node, the current time wheel node and the target time wheel node are located in the same-level time wheel, and each slot position is provided with an identification bit; registering the timeout event into a target time wheel node, storing a time threshold value in a corresponding slot position in the target time wheel node, and setting the time threshold value as an effective identification bit; and when the time wheel rotates to the target time wheel node, judging whether a callback condition is met or not according to the effective identification bit and the time threshold value, and calling a callback function to process the timeout event when the callback condition is met. The timeout event is processed through the single-stage time wheel, the dynamic memory occupation is reduced, and the processing efficiency and reliability of the timeout event can be ensured.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present disclosure relates to the technical field of timeout processing, and in particular to a method, device, vehicle, electronic device and computer-readable storage medium for processing a timeout event. Background Art

[0002] In the related art, the existing timeout event processing usually adopts the design of a multi-level time wheel to process the timeout information. However, the design of the multi-level time wheel is relatively complex, and the design of the multi-level time wheel will occupy a large dynamic memory. When there are many situations that need to be processed in a timely manner, the memory required is larger, and it is difficult to ensure the processing progress of the timeout event when an abnormality occurs in the system. At the same time, the design of the multi-level time wheel will also cause the timeout information of the same data ID to be stored multiple times in the time wheel. Since the design of the multi-level time wheel itself occupies a large amount of dynamic memory, the multiple storage of the same data will further increase the proportion of memory occupied, making the processing efficiency of the timeout event low.

[0003] Therefore, there is an urgent need for a timeout event processing method that can reduce dynamic memory usage and ensure the efficiency and reliability of timeout event processing. Summary of the invention

[0004] To overcome the problems existing in the related art, the present disclosure provides a method, device, vehicle, electronic device and computer-readable storage medium for processing a timeout event.

[0005] According to a first aspect of an embodiment of the present disclosure, a method for processing a timeout event is provided, comprising: detecting a timeout event occurring at a current time wheel node, the timeout event carrying corresponding time information and a callback function, and calculating a target time wheel node and a time threshold corresponding to the timeout event according to the time information and the current time wheel node; registering the timeout event in the target time wheel node, and storing the time threshold in a corresponding slot in the target time wheel node, and setting it as a valid identification bit; when the time wheel rotates to the target time wheel node, judging whether a callback condition is met according to the valid identification bit and the time threshold, and calling the callback function to process the timeout event if the condition is met; wherein the current time wheel node and the target time wheel node are at the same level of the time wheel, and each slot is provided with an identification bit.

[0006] In some embodiments, before detecting a timeout event at the current time wheel node, it also includes: initializing the time wheel implemented by the static memory, setting a time slice and a number of time wheel nodes, and the time wheel node rotates to the next time wheel node after a time slice; configuring multiple slots of the time wheel node through a static array, for storing the time threshold and identification bit through a two-dimensional array.

[0007] In some embodiments, when the time wheel rotates to the target time wheel node, it is determined whether the callback condition is met based on the valid identification bit and the time threshold, and when it is met, the callback function is called to process the timeout event, including: when the time wheel rotates to the target time wheel node, all identification bits under the target time wheel node are detected to obtain valid identification bits; it is determined whether the time threshold corresponding to the valid identification bit meets the callback condition; if the time threshold is less than or equal to the timeout trigger value, indicating that the callback condition is met, the callback function of the timeout event is called to perform timeout processing on the timeout event; if the time threshold is greater than the timeout trigger value, indicating that the callback condition is not met, the time threshold is subtracted from the time of one cycle of the time wheel to obtain a new time threshold, and the new time threshold is stored to cover the time threshold corresponding to the valid identification bit.

[0008] In some embodiments, the detecting of all identification bits under the target time wheel node to obtain valid identification bits therein includes: detecting all identification bits under the target time wheel node to determine whether there is a corresponding time threshold for the identification bit; when there is a corresponding time threshold for the identification bit, determining that the identification bit is a valid identification bit; when there is no corresponding time threshold for the identification bit, determining that the identification bit is an invalid identification bit.

[0009] In some embodiments, the target time wheel node and time threshold corresponding to the timeout event are calculated based on the time information and the current time wheel node, including: dividing the time information by the time for the time wheel to rotate one circle to obtain the corresponding quotient and remainder, the time for the time wheel to rotate one circle being obtained by multiplying the number of time wheel nodes by the time slice; using the quotient as the time threshold, dividing the remainder by the time slice to obtain the target time slice, and adding the current time wheel node to the target time slice to obtain the target time wheel node.

[0010] In some embodiments, the number of the time wheel nodes is set to 32, the time slice is set to 10 ms, and the number of slots is set to 500.

[0011] In some embodiments, the timeout event is a timeout event in a DDS middleware scenario.

[0012] According to a second aspect of an embodiment of the present disclosure, a device for processing a timeout event is provided, comprising: a timeout event detection module, for detecting that a timeout event occurs at a current time wheel node, the timeout event carries corresponding time information and a callback function, and a target time wheel node and a time threshold corresponding to the timeout event are calculated based on the time information and the current time wheel node, the current time wheel node and the target time wheel node are at the same level of the time wheel, and each slot is provided with an identification bit; a timeout event registration module, for registering the timeout event to the target time wheel node, and storing the time threshold to the corresponding slot in the target time wheel node, and setting it as a valid identification bit; a callback condition judgment module, for judging whether a callback condition is met based on the valid identification bit and the time threshold when the time wheel rotates to the target time wheel node, and calling the callback function to process the timeout event when the condition is met.

[0013] According to a third aspect of an embodiment of the present disclosure, a vehicle is provided, storing a set of instruction sets, wherein the instruction sets are executed by the vehicle to implement the method for processing a timeout event provided by the first aspect of the present disclosure.

[0014] According to the fourth aspect of an embodiment of the present disclosure, an electronic device is provided, comprising: a processor; a memory for storing executable instructions of the processor; the processor is used to read the executable instructions from the memory and execute the instructions to implement the method for processing a timeout event provided in the first aspect of the present disclosure.

[0015] According to a fifth aspect of an embodiment of the present disclosure, a computer-readable storage medium is provided, on which computer program instructions are stored. When the program instructions are executed by a processor, the steps of the method for processing a timeout event provided in the first aspect of the present disclosure are implemented.

[0016] The technical solution provided by the embodiments of the present disclosure may include the following beneficial effects: when a timeout event is detected in the current time wheel node, the time information and callback function carried by the timeout event are obtained, and the target time wheel node and time threshold corresponding to the timeout event are calculated according to the time information and the current time wheel node. The current time wheel node and the target time wheel node are in the same level of the time wheel, and a single-level time wheel design is adopted, which reduces the dynamic memory usage and program complexity, and each slot is provided with an identification bit; the timeout event is registered to the target time wheel node, and the time threshold is stored in the corresponding slot in the target time wheel node, and is set as a valid identification bit, so as to facilitate the rapid positioning of the timeout information according to the valid identification bit; when the time wheel rotates to the target time wheel node, it is determined whether the callback condition is met according to the valid identification bit and the time threshold, and the callback function is called to process the timeout event when it is met, and a single-level time wheel is adopted to realize the unified processing of the timeout information, which reduces the coupling and complexity of the program, and can realize the rapid positioning of the timeout through the effective identification bit, thereby ensuring the processing efficiency and reliability of the timeout event.

[0017] 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 present disclosure. BRIEF DESCRIPTION OF THE DRAWINGS

[0018] 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.

[0019] Figure 1 The present invention is a flowchart of a method for processing a timeout event according to an exemplary embodiment.

[0020] Figure 2 The figure is a flowchart of a method for initializing a time wheel according to an exemplary embodiment.

[0021] Figure 3 is a schematic structural diagram of a time wheel according to an exemplary embodiment.

[0022] Figure 4 The figure is a flowchart of a method for processing a timeout event according to an exemplary embodiment.

[0023] Figure 5 The figure is a flow chart of a method for detecting a marker according to an exemplary embodiment.

[0024] Figure 6 The figure is a flowchart of a method for calculating a time threshold according to an exemplary embodiment.

[0025] Figure 7 The invention is a block diagram of a device for processing a timeout event according to an exemplary embodiment.

[0026] Figure 8 is a block diagram of a vehicle according to an exemplary embodiment.

[0027] Fig. 9 It is a block diagram of an electronic device according to an exemplary embodiment. DETAILED DESCRIPTION

[0028] Exemplary embodiments will be described in detail below with reference to the accompanying drawings.

[0029] It should be pointed out that the relevant embodiments and drawings are only for describing exemplary embodiments provided by the present disclosure, rather than all embodiments of the present disclosure, and it should not be understood that the present disclosure is limited to the relevant exemplary embodiments.

[0030] It should be noted that the terms "first", "second", etc. used in the present disclosure are only used to distinguish different steps, devices or modules, etc. The related terms neither represent any specific technical meanings nor indicate the order or interdependence between them.

[0031] It should be noted that the modifications of the terms "one", "multiple", and "at least one" used in the present disclosure are illustrative rather than restrictive. Unless otherwise clearly indicated in the context, it should be understood as "one or more".

[0032] It should be noted that the term "and / or" used in this disclosure is used to describe the association relationship between associated objects, and generally indicates that there are at least three association relationships. For example, A and / or B can at least indicate the existence of three association relationships: A exists alone, A and B exist at the same time, and B exists alone.

[0033] It should be noted that the various steps described in the method embodiments of the present disclosure may be performed in different orders and / or in parallel. Unless otherwise specified, the scope of the present disclosure is not limited by the order of description of the steps in the relevant embodiments.

[0034] It should be noted that all actions of acquiring signals, information or data in the present disclosure are carried out in compliance with the relevant data protection laws and policies of the country where the device is located and with the authorization given by the owner of the corresponding device.

[0035] Exemplary Methods

[0036] Figure 1 is a flowchart of a method for processing a timeout event according to an exemplary embodiment. Figure 1 As shown, the method for processing the timeout event is used in the timeout task processing process, and includes the following steps:

[0037] In step S110, a timeout event is detected in the current time wheel node. The timeout event carries corresponding time information and a callback function. The target time wheel node and the time threshold corresponding to the timeout event are calculated based on the time information and the current time wheel node.

[0038] In some embodiments, while performing task processing, the time wheel is started to monitor timeout events. When a timeout event is detected, the time information and callback function carried by the timeout event are obtained. The callback function corresponds to the timeout event one-to-one, thereby achieving unified processing of timeout events while reducing program coupling. The current time wheel node where the time wheel is located is determined, and the target time wheel node and time threshold corresponding to the timeout event are calculated based on the time information and the current time wheel node. When the time wheel rotates to the target time wheel node, a judgment is made based on the time threshold as to whether to process the timeout event.

[0039] Among them, the current time wheel node and the target time wheel node are in the same level of time wheel, that is, the present disclosure adopts a single-level time wheel for timeout processing. Compared with the existing multi-level time wheel or water meter time wheel, the single-level time wheel is adopted to realize the loop processing of the timeout event, which occupies less memory and reduces the complexity of the program. Each time wheel node is provided with a plurality of slots, each slot is provided with an identification bit, and the identification bit is modified to be valid or invalid in the process of processing the timeout event to identify the timeout event.

[0040] In step S120, the timeout event is registered in the target time wheel node, and the time threshold is stored in the corresponding slot in the target time wheel node and set as a valid identification bit.

[0041] In some embodiments, a timeout event is registered based on the obtained target time wheel node, and the time threshold is stored in the corresponding slot in the target time wheel node. The time wheel node is provided with multiple slots, and different timeout events are registered through different slots to facilitate the search and update of timeout information; each slot is provided with an identification bit, but it is set as a valid identification bit only when the time threshold is stored in the slot, so that it can be recognized when it is transferred to the target time wheel node to process the corresponding timeout event; if the slot does not store the timeout threshold, it cannot be recognized and does not need to be processed.

[0042] In step S130, when the time wheel rotates to the target time wheel node, it is determined whether the callback condition is met according to the valid identification bit and the time threshold, and if it is met, the callback function is called to process the timeout event.

[0043] In some embodiments, the timing wheel rotates according to a set frequency. When it rotates to a target timing wheel node, it determines whether the corresponding timeout event meets a preset callback condition based on a valid identification bit and a time threshold in a slot of the target timing wheel node. When the callback condition is met, the corresponding callback function is called to process the timeout event. The callback functions of the timeout event are independent of each other, which reduces the coupling of the program. A single-stage timing wheel is used to process the timeout event, which reduces the complexity of the program and the memory usage. The timeout event can be quickly located through a valid identification bit, thereby ensuring the efficiency of timeout processing.

[0044] In the above embodiment, when a timeout event is detected at the current time wheel node, the time information and callback function carried by the timeout event are obtained, and the target time wheel node and time threshold corresponding to the timeout event are calculated according to the time information and the current time wheel node. The current time wheel node and the target time wheel node are at the same level of the time wheel, and a single-level time wheel design is adopted, which reduces the dynamic memory usage and program complexity, and each slot is provided with an identification bit; the timeout event is registered to the target time wheel node, and the time threshold is stored in the corresponding slot in the target time wheel node, and is set as a valid identification bit, so as to facilitate the rapid positioning of the timeout information according to the valid identification bit; when the time wheel rotates to the target time wheel node, it is determined whether the callback condition is met according to the valid identification bit and the time threshold, and the callback function is called to process the timeout event when it is met, and a single-level time wheel is adopted to realize the unified processing of the timeout information, which reduces the coupling and complexity of the program, and can realize the rapid positioning of the timeout through the effective identification bit, thereby ensuring the processing efficiency and reliability of the timeout event.

[0045] Figure 2 is a flowchart of a method for initializing a time wheel according to an exemplary embodiment. Figure 2 As shown, the time wheel initialization method is used before step S110, and includes the following steps:

[0046] In step S210, the time wheel implemented by the static memory is initialized, the time slice and a number of time wheel nodes are set, and the time wheel node rotates to the next time wheel node after a time slice.

[0047] Specifically, before performing a timeout event processing, initialize the time wheel implemented by the static memory, set the time slice and several time wheel nodes, for example, set the time wheel node to 32, 64, 128, etc. When the time wheel rotates, the time wheel node rotates to the next time wheel node after passing a time slice. The number of time slices and time wheel nodes can be set accordingly according to the actual application scenario to facilitate the corresponding timeout processing.

[0048] Among them, the number of time wheel nodes is set to 32, the time slice is set to 10ms, and the number of slots is set to 500.

[0049] like Figure 3 As shown, the time slice is set to 10ms, the number of time wheel nodes is set to 32, including node0 to node31, and the number of slots under each time wheel node is set to 500. Figure 3 The node pointed by the middle pointer is the current time wheel node node8. After all timeout events in the current time wheel node node8 are processed within 10ms, the next time wheel node node9 is moved to process the timeout events of the time wheel node node9.

[0050] In step S220, multiple slots of the time wheel node are configured through a static array to store the time threshold and the identification bit through a two-dimensional array.

[0051] Specifically, after dividing into several time wheel nodes, multiple slots of the time wheel nodes are configured through static data. Multiple slots use a two-dimensional array to store time thresholds and identification bits. The time threshold records the number of time slices required to register a distance timeout event.

[0052] In this embodiment, the time wheel implemented by the static memory is initialized, and the time slice and several time wheel nodes are set according to actual needs. After a time slice, the time wheel node rotates to the next time wheel node, and multiple slots of the time wheel node are configured in a static array. The slots use a two-dimensional array to store time thresholds and identification bits. The implementation of the time wheel based on the static memory can greatly improve the security of communication and accurately monitor communication timeouts. It is suitable for communication scenarios with high reliability requirements, such as information transmission in the power domain of passenger cars and commercial vehicles, or high-reliability information transmission in military, aerospace and other fields.

[0053] Figure 4 is a flowchart of a method for processing a timeout event according to an exemplary embodiment. Figure 4 As shown, the timeout event processing method is used in step S130, including the following steps:

[0054] In step S310, when the time wheel rotates to the target time wheel node, all identification bits under the target time wheel node are detected to obtain valid identification bits therein.

[0055] Specifically, the time wheel rotates according to the set time slice. After several time slices, when the time wheel rotates to the target time wheel node, all identification bits under the target time wheel node are detected to obtain the valid identification bits, so as to quickly locate the timeout information according to the valid identification bits, and facilitate the search and update of the timeout information.

[0056] In step S320, it is determined whether the time threshold corresponding to the valid flag meets the callback condition.

[0057] Specifically, the time threshold of the corresponding slot is obtained according to the valid identification bit, and it is determined whether the time threshold meets the callback condition. The callback condition can be pre-configured by the program or set according to the actual time wheel needs.

[0058] In step S330, if the time threshold is less than or equal to the timeout trigger value, indicating that the callback condition is met, the callback function of the timeout event is called to perform timeout processing on the timeout event.

[0059] Specifically, when it is detected that the time threshold is less than or equal to the timeout trigger value, it means that the callback condition is met, and the callback function of the corresponding timeout event is called, and the timeout event of the slot corresponding to the valid identification position is processed. For example, when the timeout trigger value of the callback condition is set to 320ms, if the time threshold corresponding to the valid identification position is 300ms, it means that the timeout information under the current slot needs to be processed. After the timeout event calls the callback function, the timeout information in the current slot is cleared, the identification position is restored to the invalid identification position, and the slot waits for the registration of the next timeout event.

[0060] In step S340, if the time threshold is greater than the timeout trigger value, indicating that the callback condition is not met, the time threshold is subtracted from the number of rotations of the time wheel to obtain a new time threshold, and the new time threshold is stored to cover the time threshold corresponding to the valid identification bit.

[0061] Specifically, when it is detected that the time threshold is greater than the timeout trigger value, it means that the timeout event under the current slot does not meet the callback condition. The time required for one cycle of the time wheel is subtracted from the time threshold to obtain a new time threshold. The new time threshold is used to overwrite the original time threshold under the corresponding slot for storage, thereby realizing the processing of the original timeout information and improving the timeout processing performance.

[0062] For example, when the timeout trigger value of the callback condition is set to 0, if the time threshold corresponding to the valid identification bit is 1, it means that the processing time of the timeout event is longer than the time required for the time wheel to rotate one circle, and the time wheel loops. 1 is subtracted from 1 circle of the time wheel rotation to obtain a new time threshold of 0, which overwrites the original 1 and is stored in the corresponding slot, indicating that the time wheel needs to be rotated for another circle, and the current timeout event will be processed when the time wheel rotates to the current time wheel node next time. If the time threshold corresponding to the valid identification bit is 3, it means that the time wheel needs to rotate for 3 circles before processing the current timeout event. Each time the time wheel rotates to the current time wheel node, the time threshold is subtracted by 1 (1 represents the number of time wheel circles from the last time the time wheel rotated to the target time wheel node to the current time wheel rotation to the target time wheel node), and a new time threshold is obtained and stored until it is detected that the time threshold is less than 0, and then the corresponding timeout event is timed out.

[0063] In this embodiment, when the time wheel rotates to the target time wheel node, all identification bits under the target time wheel node are detected to obtain the valid identification bits, and it is determined whether the time threshold corresponding to the valid identification bits meets the callback conditions. When the time threshold is less than or equal to the timeout trigger value, it indicates that the callback conditions are met, and the callback function of the timeout event is called to perform timeout processing on the timeout event. When the time threshold is greater than the timeout trigger value, it indicates that the callback conditions are not met, and the time threshold is subtracted from the time of one cycle of the time wheel to obtain a new time threshold, and the time threshold corresponding to the valid identification bit is covered and stored. According to the single time wheel design, based on the time threshold and the valid identification bit, efficient processing of timeout events can be achieved.

[0064] Figure 5 is a flow chart of a method for detecting a marker according to an exemplary embodiment. Figure 5 As shown, the identification bit detection method is used before step S310, and includes the following steps:

[0065] In step S410, all flags under the target time wheel node are detected to determine whether the flag has a corresponding time threshold.

[0066] Specifically, since there are multiple slots under the time wheel node, after the timeout event is registered, the corresponding slot will store a time threshold. Therefore, when judging whether the identification bit is valid, all identification bits under the target time wheel node can be detected to determine whether there is a corresponding time threshold in the slot where the identification bit is located, thereby determining whether the identification bit is valid.

[0067] In step S420, when the flag has a corresponding time threshold, the flag is determined to be a valid flag.

[0068] Specifically, when a corresponding time threshold exists in the slot where the identification bit is located, it indicates that a timeout event is registered in the slot, and the identification bit is then identified as a valid identification bit, thereby enabling rapid positioning of the timeout event.

[0069] In step S430, when the flag does not have a corresponding time threshold, the flag is determined to be an invalid flag.

[0070] Specifically, when there is no corresponding time threshold for the identification bit, it means that no timeout event is registered in the slot, and it is an empty slot, and the identification bit is determined to be an invalid identification bit.

[0071] In this embodiment, all identification bits under the target time wheel node are detected to determine whether there is a corresponding time threshold for the identification bit. When the corresponding time threshold exists in the slot where the identification bit is located, the identification bit is determined to be a valid identification bit. Otherwise, when the corresponding time threshold does not exist in the slot where the identification bit is located, the identification bit is determined to be an invalid identification bit. The validity of the identification bit is judged based on whether the time threshold exists in the slot, so that the timeout information can be quickly located based on the valid identification bit, thereby improving the processing efficiency of timeout events.

[0072] Figure 6 is a flow chart of a method for calculating a time threshold according to an exemplary embodiment. Figure 6 As shown, the time threshold calculation method is used in step S110, including the following steps:

[0073] In step S510, the time information is divided by the time for the time wheel to rotate once to obtain the corresponding quotient and remainder. The time for the time wheel to rotate once is obtained by multiplying a number of time wheel nodes by the time slice.

[0074] Specifically, when calculating the time threshold, the time information carried by the timeout event is divided by the time it takes for the time wheel to rotate once. When the time wheel node is set to 32 and the time slice is set to 10ms, the time it takes for the time wheel to rotate once is obtained by multiplying the time wheel node by the time slice, which is 320ms.

[0075] In step S520, the quotient is used as the time threshold, the remainder is divided by the time slice to obtain the target time slice, and the current time wheel node is added to the target time slice to obtain the target time wheel node.

[0076] Specifically, if the time information carried by the timeout information is 500ms, 500 is divided by 320, and the quotient is 1, and the remainder is 180. The quotient can be used as the time threshold, indicating that the time wheel needs to rotate one circle before the current timeout event is processed; the remainder is divided by the time slice to get 18. If the current time wheel node is 8, the target time wheel node is 8+18=26, that is, the current timeout event needs to be registered to the time wheel node node26, and the current timeout event is processed when the time wheel rotates to node26.

[0077] If the time information is 700ms, the quotient is 2, and the remainder is 60, then the time threshold is 2, which means that two more rotations are required before the current timeout event is processed. At the same time, using 8+60 / 10, the target time wheel node is node14, that is, after two rotations, the corresponding timeout event is processed at node14.

[0078] In this embodiment, according to the time information carried by the timeout event, the corresponding quotient and remainder are obtained by dividing it by the time for the time wheel to rotate one circle. The time for the time wheel to rotate one circle is obtained by multiplying a number of time wheel nodes by the time slice. The quotient is used as the time threshold, and the remainder is divided by the time slice to obtain the target time slice. The current time wheel node is added with the target time slice to obtain the target time wheel node, thereby realizing the use of a single-level time wheel for timeout event processing and reducing memory overhead.

[0079] In one embodiment, the timeout event is a timeout event in a DDS middleware scenario.

[0080] Specifically, since DDS middleware is widely used in distributed systems and real-time data processing, its publish-subscribe model provides efficient data exchange and communication methods for multiple applications. However, during the use of DDS communication, there are security issues such as data loss and blocking, and responsive security measures are required to ensure communication security. Therefore, the above-mentioned timeout event processing method can be adopted. When DDS recognizes a timeout event, a single-level time wheel is used to perform timeout processing, so that DDS communication can avoid repeated registration of the same timeout information, reduce dynamic memory usage, and improve the efficiency and reliability of DDS timeout event processing.

[0081] In one embodiment, if there are multiple timeout events with the same timeout threshold in the same time wheel node, for example, the time thresholds of timeout events such as vehicle speed, direction or vehicle location information are all 0, and are all located in the time wheel node node8, then the callback function can be called in a first-in-first-out manner. For example, when the vehicle speed is registered first among the above three timeout events, the callback function corresponding to the vehicle speed is called first, and the callback function is called in the order of registration of the timeout events to ensure the efficiency and reliability of timeout event processing.

[0082] Exemplary Devices

[0083] Figure 7 FIG. 1 is a block diagram of a device for processing a timeout event according to an exemplary embodiment. Figure 7 The device 700 includes a timeout event detection module 710, a timeout event registration module 720 and a callback condition judgment module 730.

[0084] The timeout event detection module 710 is used to detect that a timeout event occurs at the current time wheel node. The timeout event carries the corresponding time information and callback function. The target time wheel node and the time threshold corresponding to the timeout event are calculated based on the time information and the current time wheel node. The current time wheel node and the target time wheel node are at the same level of the time wheel, and each slot is provided with an identification bit;

[0085] The timeout event registration module 720 is used to register the timeout event in the target time wheel node, and store the time threshold in the corresponding slot in the target time wheel node and set it as a valid identification bit;

[0086] The callback condition judgment module 730 is used to judge whether the callback condition is met according to the valid identification bit and the time threshold when the time wheel rotates to the target time wheel node, and call the callback function to process the timeout event when it is met.

[0087] In one embodiment, the device also includes: a time wheel initialization module, which is used to initialize the time wheel implemented by the static memory, set the time slice and a number of time wheel nodes, and the time wheel node rotates to the next time wheel node after passing a time slice; a slot configuration module, which is used to configure multiple slots of the time wheel node through a static array, and is used to store time thresholds and identification bits through a two-dimensional array.

[0088] In one embodiment, the device also includes: an identification position detection module, which is used to detect all identification positions under the target time wheel node when the time wheel rotates to the target time wheel node, and obtain the valid identification positions therein; a time threshold judgment module, which is used to judge whether the time threshold corresponding to the valid identification position meets the callback condition; a callback function calling module, which is used to call the callback function of the timeout event and perform timeout processing on the timeout event when the time threshold is less than or equal to the timeout trigger value, indicating that the callback condition is met; a time threshold processing module, which is used to use the time threshold minus the number of rotations of the time wheel to obtain a new time threshold when the time threshold is greater than the timeout trigger value, indicating that the callback condition is not met, and the new time threshold is stored to cover the time threshold corresponding to the valid identification position.

[0089] In one embodiment, the device also includes: a time threshold detection module, which is used to detect all identification bits under the target round time node and determine whether the identification bit has a corresponding time threshold; a valid identification bit identification module, which is used to identify the identification bit as a valid identification bit when the identification bit has a corresponding time threshold; and an invalid identification bit identification module, which is used to identify the identification bit as an invalid identification bit when the identification bit does not have a corresponding time threshold.

[0090] In one embodiment, the device also includes: a time information calculation module, which is used to obtain the corresponding quotient and remainder according to the time information divided by the time for the time wheel to rotate one circle, and the time for the time wheel to rotate one circle is obtained by multiplying a number of time wheel nodes by the time slice; a target node acquisition module, which is used to use the quotient as the time threshold, divide the remainder by the time slice to obtain the target time slice, and add the current time wheel node to the target time slice to obtain the target time wheel node.

[0091] In the above embodiment, a method for processing a timeout event is implemented through the operation of the device, ensuring that the device can implement all contents of a method for processing a timeout event.

[0092] Example Vehicles

[0093] Figure 8 is a block diagram of a vehicle 800 according to an exemplary embodiment. The vehicle 800 may be a fuel vehicle, a hybrid vehicle, an electric vehicle, a fuel cell vehicle or other types of vehicles.

[0094] Reference Figure 8 The vehicle 800 may include multiple subsystems, for example, a driving system 810, a control system 820, a perception system 830, a communication system 840, an information display system 850, and a computing system 860. The vehicle 800 may also include more or fewer subsystems, and each subsystem may also include multiple components, which are not described one by one here.

[0095] The driving system 810 includes components that provide power movement for the vehicle 800, such as an engine, an energy source, a transmission device, etc.

[0096] The control system 820 includes components that provide control for the vehicle 800, such as vehicle control, cockpit equipment control, and driving assistance control.

[0097] The perception system 830 includes components that provide the vehicle 800 with surrounding environment perception, such as a vehicle positioning system, a laser sensor, a voice sensor, an ultrasonic sensor, a camera device, and the like.

[0098] The communication system 840 includes components that provide communication connections for the vehicle 800, such as mobile communication networks (such as 3G, 4G, 5G networks, etc.), WiFi, Bluetooth, and Internet of Vehicles.

[0099] The information display system 850 includes components that provide various information displays for the vehicle 800, such as vehicle information display, navigation information display, entertainment information display, etc.

[0100] The computing and processing system 860 includes components that provide data computing and processing capabilities for the vehicle 800. The computing and processing system 860 may include at least one processor 861 and a memory 862. The processor 861 may execute instructions stored in the memory 862.

[0101] The processor 861 may be any conventional processor, such as a commercially available CPU. The processor may also include a graphics processor (Graphic Process Unit, GPU), a field programmable gate array (Field Programmable Gate Array, FPGA), a system on chip (System on Chip, SOC), an application specific integrated circuit (Application Specific Integrated Circuit, ASIC) or a combination thereof.

[0102] Memory 862 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.

[0103] In the embodiment of the present disclosure, a set of instruction sets is stored in the memory 862, and the processor 861 can execute the instruction set to implement all or part of the steps of the method for processing a timeout event described in any of the above exemplary embodiments.

[0104] Exemplary Electronic Devices

[0105] Fig. 9 1 is a block diagram of an electronic device 900 according to an exemplary embodiment. The electronic device 900 may be a vehicle controller, a vehicle terminal, a vehicle computer or other types of electronic devices.

[0106] Reference Fig. 9, the electronic device 900 may include at least one processor 910 and a memory 920. The processor 910 may execute instructions stored in the memory 920. The processor 910 is communicatively connected to the memory 920 via a data bus. In addition to the memory 920, the processor 910 may also be communicatively connected to an input device 930, an output device 940, and a communication device 950 via a data bus.

[0107] The processor 910 may be any conventional processor, such as a commercially available CPU. The processor may also include a graphics processor (Graphic Process Unit, GPU), a field programmable gate array (Field Programmable Gate Array, FPGA), a system on chip (System on Chip, SOC), an application specific integrated circuit (Application Specific Integrated Circuit, ASIC) or a combination thereof.

[0108] The memory 920 may be implemented by any type of volatile or nonvolatile 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.

[0109] In an embodiment of the present disclosure, executable instructions are stored in the memory 920, and the processor 910 can read the executable instructions from the memory 920 and execute the instructions to implement all or part of the steps of the method for processing a timeout event described in any of the above exemplary embodiments.

[0110] Exemplary computer-readable storage media

[0111] In addition to the above methods and devices, the exemplary embodiments of the present disclosure may also be a computer program product or a computer-readable storage medium storing the computer program product. The computer product includes computer program instructions that can be executed by a processor to implement all or part of the steps described in any method in the above exemplary embodiments.

[0112] The computer program product may be written in any combination of one or more programming languages ​​to write program codes for performing the operations of the embodiments of the present application, including object-oriented programming languages, such as Java, C++, etc., and also conventional procedural programming languages, such as "C" language or similar programming languages ​​and scripting languages ​​(e.g., Python). The program code may be executed entirely on the user computing device, partially on the user computing device, as an independent software package, partially on the user computing device and partially on the remote computing device, or entirely on the remote computing device or server.

[0113] The computer readable storage medium can adopt any combination of one or more readable media. The readable medium can be a readable signal medium or a readable storage medium. The readable storage medium can include, for example, but is not limited to, a system, device or device of electricity, magnetism, light, electromagnetic, infrared, or semiconductor, or any combination of the above. More specific examples of readable storage media include: a static random access memory (SRAM) with one or more wires electrically connected, an electrically erasable programmable read-only memory (EEPROM), an erasable programmable read-only memory (EPROM), a programmable read-only memory (PROM), a read-only memory (ROM), a magnetic storage, a flash memory, a magnetic disk or an optical disk, or any suitable combination of the above.

[0114] Those skilled in the art will readily appreciate other embodiments of the present disclosure after considering the specification and practicing the present disclosure. This application is intended to cover any variations, uses or adaptations of the present disclosure, which follow the general principles of the present disclosure and include common knowledge or customary technical means in the art that are not disclosed in the present disclosure. The specification and examples are to be considered as exemplary only, and the true scope and spirit of the present disclosure are indicated by the following claims.

[0115] 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 may be made without departing from the scope thereof. The scope of the present disclosure is limited only by the appended claims.

Claims

1. A method for processing a timeout event, characterized in that: include: A timeout event is detected at the current time wheel node, the timeout event carries corresponding time information and a callback function, and a target time wheel node and a time threshold corresponding to the timeout event are calculated according to the time information and the current time wheel node; Registering the timeout event in the target time wheel node, and storing the time threshold in the corresponding slot in the target time wheel node, and setting it as a valid identification bit; When the time wheel rotates to the target time wheel node, judging whether the callback condition is met according to the valid identification bit and the time threshold, and calling the callback function to process the timeout event if it is met; The current time wheel node and the target time wheel node are in the same level of the time wheel, and each slot is provided with an identification bit.

2. The method for processing a timeout event according to claim 1, characterized in that: Before the timeout event is detected at the current time wheel node, the method further includes: Initialize the time wheel implemented by the static memory, set the time slice and a number of time wheel nodes, and the time wheel node rotates to the next time wheel node after a time slice; A plurality of slots of the timing wheel node are configured through a static array, and are used to store the time threshold and the identification bit through a two-dimensional array.

3. The method for processing a timeout event according to claim 1, characterized in that: When the time wheel rotates to the target time wheel node, judging whether the callback condition is met according to the valid identification bit and the time threshold, and calling the callback function to process the timeout event when the condition is met, including: When the time wheel rotates to the target time wheel node, all identification bits under the target time wheel node are detected to obtain valid identification bits therein; Determine whether the time threshold corresponding to the valid identification bit meets the callback condition; If the time threshold is less than or equal to the timeout trigger value, indicating that the callback condition is met, the callback function of the timeout event is called to perform timeout processing on the timeout event; If the time threshold is greater than the timeout trigger value, indicating that the callback condition is not met, the new time threshold is obtained by subtracting the number of rotations of the time wheel from the time threshold, and the new time threshold is stored to cover the time threshold corresponding to the valid identification bit.

4. The method for processing a timeout event according to claim 3, characterized in that: The detecting all identification bits under the target time wheel node to obtain valid identification bits therein includes: Detect all identification bits under the target round time node, and determine whether the identification bits have a corresponding time threshold; When the corresponding time threshold exists for the identification bit, the identification bit is determined to be a valid identification bit; When there is no corresponding time threshold for the identification bit, the identification bit is deemed to be an invalid identification bit.

5. The method for processing a timeout event according to claim 2, characterized in that: The step of calculating the target time wheel node and the time threshold corresponding to the timeout event according to the time information and the current time wheel node includes: Dividing the time information by the time for the time wheel to rotate once obtains a corresponding quotient and remainder, wherein the time for the time wheel to rotate once is obtained by multiplying the number of time wheel nodes by the time slice; The quotient is used as the time threshold, the remainder is divided by the time slice to obtain a target time slice, and the current time wheel node is added with the target time slice to obtain a target time wheel node.

6. The method for processing a timeout event according to claim 2, characterized in that: The number of the time wheel nodes is set to 32, the time slice is set to 10 ms, and the number of slots is set to 500.

7. The method for processing a timeout event according to any one of claims 1 to 6, characterized in that: The timeout event is a timeout event in the DDS middleware scenario.

8. A device for processing a timeout event, characterized in that: include: A timeout event detection module is used to detect a timeout event at the current time wheel node, the timeout event carries corresponding time information and a callback function, and calculates the target time wheel node and time threshold corresponding to the timeout event according to the time information and the current time wheel node. The current time wheel node and the target time wheel node are at the same level of the time wheel, and each slot is provided with an identification bit; A timeout event registration module, used to register the timeout event in the target time wheel node, and store the time threshold in a corresponding slot in the target time wheel node and set it as a valid identification bit; The callback condition judgment module is used to judge whether the callback condition is met according to the valid identification bit and the time threshold when the time wheel rotates to the target time wheel node, and call the callback function to process the timeout event when it is met.

9. A vehicle, characterized in that: A set of instruction sets is stored, and the instruction sets are executed by the vehicle to implement the method for processing the timeout event described in any one of claims 1-7.

10. An electronic device, characterized in that: include: processor; a memory for storing instructions executable by the processor; The processor is used to read the executable instructions from the memory and execute the instructions to implement the method for processing the timeout event described in any one of claims 1-7.

11. A computer-readable storage medium having computer program instructions stored thereon, characterized in that: When the program instructions are executed by a processor, the steps of the method for processing a timeout event described in any one of claims 1 to 7 are implemented.