mirror of
https://gitee.com/openharmony/third_party_libuv
synced 2025-01-14 00:30:53 +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_
|
||||
|
||||
#include <stddef.h> /* NULL */
|
||||
#include "uv_log.h"
|
||||
|
||||
#if defined(__GNUC__)
|
||||
# define HEAP_EXPORT(declaration) __attribute__((unused)) static declaration
|
||||
@ -137,6 +138,12 @@ HEAP_EXPORT(void heap_insert(struct heap* heap,
|
||||
|
||||
/* Insert the new node. */
|
||||
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;
|
||||
heap->nelts += 1;
|
||||
|
||||
@ -178,11 +185,17 @@ HEAP_EXPORT(void heap_remove(struct heap* heap,
|
||||
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. */
|
||||
child = *max;
|
||||
*max = NULL;
|
||||
heap->nelts -= 1;
|
||||
|
||||
if (child == node) {
|
||||
/* 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) {
|
||||
#if defined(USE_OHOS_DFX)
|
||||
return 0;
|
||||
#endif
|
||||
#if defined(__ANDROID_API__)
|
||||
return 0; /* Possibly available but blocked by seccomp. */
|
||||
#elif defined(__arm__) && __SIZEOF_POINTER__ == 4
|
||||
|
Loading…
x
Reference in New Issue
Block a user