Hello,
yes, good idea. It would be also probably a good idea to have a bit more time to review
these commits in git master before merging them directly to stable branch, as done some
minutes ago.
Cheers,
Henning
-----Original Message-----
From: Daniel-Constantin Mierla via sr-dev <sr-dev(a)lists.kamailio.org>
Sent: Dienstag, 6. Februar 2024 08:40
To: Kamailio (SER) - Development Mailing List <sr-dev(a)lists.kamailio.org>
Cc: Daniel-Constantin Mierla <miconda(a)gmail.com>
Subject: [sr-dev] Re: git:master:ba921b21: core/rthread.h: add prototype for
db queries
Hello,
by latest commits, I notice that more functions need to be executed in another
thread when having to deal libssl3. I wonder if it is not an alternative to run
only the tls module functions in other threads?
If not, maybe we can introduce a global parameter (or per module) that makes
this wrapper functions to execute directly or through another thread. There
are cases when it is no need to run through different threads.
Cheers,
Daniel
On 06.02.24 03:40, S-P Chan via sr-dev wrote:
Module: kamailio
Branch: master
Commit: ba921b2112e87625fba5789d1b049161bb611073
URL:
https://github.com/kamailio/kamailio/commit/ba921b2112e87625fba5789
d1b
049161bb611073
Author: S-P Chan <shihping.chan(a)gmail.com>
Committer: S-P Chan <shihping.chan(a)gmail.com>
Date: 2024-02-06T10:17:53+08:00
core/rthread.h: add prototype for db queries
---
Modified: src/core/rthreads.h
---
Diff:
https://github.com/kamailio/kamailio/commit/ba921b2112e87625fba5789
d1b
049161bb611073.diff
Patch:
https://github.com/kamailio/kamailio/commit/ba921b2112e87625fba5789
d1b
049161bb611073.patch
---
diff --git a/src/core/rthreads.h b/src/core/rthreads.h index
a5ad7670dae..a416ad2ca50 100644
--- a/src/core/rthreads.h
+++ b/src/core/rthreads.h
@@ -98,3 +98,60 @@ static void run_threadV(_thread_protoV fn)
pthread_join(tid, NULL);
}
#endif
+
+/*
+ * prototype: int fn(void *, void *) { ... } */ #ifdef
+KSR_RTHREAD_NEED_4PP typedef int (*_thread_proto4PP)(void *, void *);
+struct _thread_args4PP {
+ _thread_proto4PP fn;
+ void *arg1;
+ void *arg2;
+ int *ret;
+};
+static void *run_thread_wrap4PP(struct _thread_args4PP *args) {
+ *args->ret = (*args->fn)(args->arg1, args->arg2);
+ return NULL;
+}
+
+static int run_thread4PP(_thread_proto4PP fn, void *arg1, void *arg2)
+{
+ pthread_t tid;
+ int ret;
+
+ pthread_create(&tid, NULL, (_thread_proto)run_thread_wrap4PP,
+ &(struct _thread_args4PP){fn, arg1, arg2, &ret});
+ pthread_join(tid, NULL);
+
+ return ret;
+}
+#endif
+
+/*
+ * prototype: void fn(void *) { ... } */ #ifdef KSR_RTHREAD_NEED_0P
+typedef void (*_thread_proto0P)(void *); struct _thread_args0P {
+ _thread_proto0P fn;
+ void *arg1;
+};
+static void *run_thread_wrap0P(struct _thread_args0P *args) {
+ (*args->fn)(args->arg1);
+ return NULL;
+}
+
+static void run_thread0P(_thread_proto0P fn, void *arg1) {
+ pthread_t tid;
+
+ pthread_create(&tid, NULL, (_thread_proto)run_thread_wrap0P,
+ &(struct _thread_args0P){fn, arg1});
+ pthread_join(tid, NULL);
+}
+#endif
_______________________________________________
Kamailio (SER) - Development Mailing List To unsubscribe send an email
to sr-dev-leave(a)lists.kamailio.org
--
Daniel-Constantin Mierla (@
asipto.com)
twitter.com/miconda --
linkedin.com/in/miconda Kamailio Consultancy,
Training and Development Services --
asipto.com Kamailio Advanced Training,
February 20-22, 2024 --
asipto.com Kamailio World Conference, April 18-19,
2024, Berlin --
kamailioworld.com
_______________________________________________
Kamailio (SER) - Development Mailing List To unsubscribe send an email to sr-
dev-leave(a)lists.kamailio.org