信号槽使用mythread

This commit is contained in:
2025-06-25 11:29:06 +08:00
parent b64401d556
commit 2cfdb4a84f
8 changed files with 43 additions and 101 deletions

View File

@@ -7,6 +7,7 @@
#include "stdio.h"
#include "string.h"
#include "exception.h"
#include "debug.h"
#include "signal_test.h"
@@ -115,14 +116,15 @@ slot test_slot3(test_sig_obj3* obj, int a, int b) {
slot test_slot3_2(test_sig_obj3* obj, int a, int b, const char* c) {
printf("test_slot3_2 a=%d, b=%d, c=%s\n", a, b, c);
throw_("test_slot3_2 err");
}
static test_sig_obj g_sig_obj = { .test_var = 1, };
static test_sig_obj2 g_sig_obj2 = { .test_var = 2, };
static test_sig_obj3 g_sig_obj3;
int thread_fun_s(void* t) {
mythread_t* th = sigthread_init();
int thread_fun(void* t) {
mythread_t* th = sigthread_init("signal_thread");
printf("thread_fun start\n");
connect(&g_sig_obj, test_signal, th, &g_sig_obj2, test_slot);
connect(&g_sig_obj, test_signal, th, &g_sig_obj3, test_slot3);