mirror of
https://gitee.com/openharmony/third_party_libuv
synced 2025-01-14 08:40:44 +00:00
增加timer堆操作稳定性
Signed-off-by: liaoxingxing <liaoxingbin@h-partners.com>
This commit is contained in:
parent
670144b13d
commit
1b37fc333e
@ -17,6 +17,7 @@
|
|||||||
#define UV_SRC_HEAP_H_
|
#define UV_SRC_HEAP_H_
|
||||||
|
|
||||||
#include <stddef.h> /* NULL */
|
#include <stddef.h> /* NULL */
|
||||||
|
#include "uv_log.h"
|
||||||
|
|
||||||
#if defined(__GNUC__)
|
#if defined(__GNUC__)
|
||||||
# define HEAP_EXPORT(declaration) __attribute__((unused)) static declaration
|
# define HEAP_EXPORT(declaration) __attribute__((unused)) static declaration
|
||||||
@ -137,6 +138,12 @@ HEAP_EXPORT(void heap_insert(struct heap* heap,
|
|||||||
|
|
||||||
/* Insert the new node. */
|
/* Insert the new node. */
|
||||||
newnode->parent = *parent;
|
newnode->parent = *parent;
|
||||||
|
#ifdef USE_OHOS_DFX
|
||||||
|
if (child == NULL || newnode == NULL) {
|
||||||
|
UV_LOGF("Child is NULL, this may be due to multi-threaded calls.");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
*child = newnode;
|
*child = newnode;
|
||||||
heap->nelts += 1;
|
heap->nelts += 1;
|
||||||
|
|
||||||
@ -178,11 +185,17 @@ HEAP_EXPORT(void heap_remove(struct heap* heap,
|
|||||||
k -= 1;
|
k -= 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
heap->nelts -= 1;
|
#ifdef USE_OHOS_DFX
|
||||||
|
if (child == NULL) {
|
||||||
|
UV_LOGF("Child is NULL, this may be due to multi-threaded calls.");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
/* Unlink the max node. */
|
/* Unlink the max node. */
|
||||||
child = *max;
|
child = *max;
|
||||||
*max = NULL;
|
*max = NULL;
|
||||||
|
heap->nelts -= 1;
|
||||||
|
|
||||||
if (child == node) {
|
if (child == node) {
|
||||||
/* We're removing either the max or the last node in the tree. */
|
/* We're removing either the max or the last node in the tree. */
|
||||||
|
@ -481,6 +481,9 @@ int uv__io_uring_register(int fd, unsigned opcode, void* arg, unsigned nargs) {
|
|||||||
|
|
||||||
|
|
||||||
static int uv__use_io_uring(void) {
|
static int uv__use_io_uring(void) {
|
||||||
|
#if defined(USE_OHOS_DFX)
|
||||||
|
return 0;
|
||||||
|
#endif
|
||||||
#if defined(__ANDROID_API__)
|
#if defined(__ANDROID_API__)
|
||||||
return 0; /* Possibly available but blocked by seccomp. */
|
return 0; /* Possibly available but blocked by seccomp. */
|
||||||
#elif defined(__arm__) && __SIZEOF_POINTER__ == 4
|
#elif defined(__arm__) && __SIZEOF_POINTER__ == 4
|
||||||
|
Loading…
x
Reference in New Issue
Block a user