gazelle/0049-post-thread_phase1-sem-to-avoid-block-main-thread-wh.patch
jiangheng14 46ab1e1590 backport upstream patches:
update README
    fix some bugs
    refactor pkt read send to improve performance
    refactor kernle event toimproveperformance

(cherry picked from commit a8c66704608ca83c799adab88be6214bccdcfa44)
2022-07-07 22:46:16 +08:00

40 lines
1.3 KiB
Diff

From e0d26480fc3919affe10b55ccbb5837aa88c5c57 Mon Sep 17 00:00:00 2001
From: jiangheng <jiangheng14@huawei.com>
Date: Mon, 16 May 2022 18:34:55 +0800
Subject: [PATCH 10/18] post thread_phase1 sem to avoid block main thread when
stack error
---
src/lstack/core/lstack_protocol_stack.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/src/lstack/core/lstack_protocol_stack.c b/src/lstack/core/lstack_protocol_stack.c
index eb975c0..88513ba 100644
--- a/src/lstack/core/lstack_protocol_stack.c
+++ b/src/lstack/core/lstack_protocol_stack.c
@@ -339,11 +339,13 @@ static struct protocol_stack * stack_thread_init(uint16_t queue_id)
struct protocol_stack *stack = malloc(sizeof(*stack));
if (stack == NULL) {
+ sem_post(&stack_group->thread_phase1);
LSTACK_LOG(ERR, LSTACK, "malloc stack failed\n");
return NULL;
}
if (init_stack_value(stack, queue_id) != 0) {
+ sem_post(&stack_group->thread_phase1);
free(stack);
return NULL;
}
@@ -356,6 +358,7 @@ static struct protocol_stack * stack_thread_init(uint16_t queue_id)
if (use_ltran()) {
if (client_reg_thrd_ring() != 0) {
+ sem_post(&stack_group->thread_phase1);
free(stack);
return NULL;
}
--
2.23.0