Module: kamailio
Branch: master
Commit: fb7c4ec9a33d8147094aa664ce3c96b6c3cb7d35
URL: 
https://github.com/kamailio/kamailio/commit/fb7c4ec9a33d8147094aa664ce3c96b6c3cb7d35

Author: S-P Chan <shihping.c...@gmail.com>
Committer: S-P Chan <shihping.c...@gmail.com>
Date: 2024-02-07T14:08:01+08:00

core/rthreads.h: fix missing returns

---

Modified: src/core/rthreads.h

---

Diff:  
https://github.com/kamailio/kamailio/commit/fb7c4ec9a33d8147094aa664ce3c96b6c3cb7d35.diff
Patch: 
https://github.com/kamailio/kamailio/commit/fb7c4ec9a33d8147094aa664ce3c96b6c3cb7d35.patch

---

diff --git a/src/core/rthreads.h b/src/core/rthreads.h
index 897e6b8d9ed..2f922be5a75 100644
--- a/src/core/rthreads.h
+++ b/src/core/rthreads.h
@@ -40,16 +40,17 @@ static void *run_threadP(_thread_proto fn, void *arg)
        pthread_t tid;
        void *ret;
 
-        if(likely(ksr_tls_threads_mode == 0 || (ksr_tls_threads_mode == 1 && 
process_no > 0))) {
-            return fn(arg);
-        }
+       if(likely(ksr_tls_threads_mode == 0
+                          || (ksr_tls_threads_mode == 1 && process_no > 0))) {
+               return fn(arg);
+       }
 
        pthread_create(&tid, NULL, fn, arg);
        pthread_join(tid, &ret);
 
        return ret;
 #else
-        return fn(arg);
+       return fn(arg);
 #endif /* USE_TLS */
 }
 #endif
@@ -76,9 +77,10 @@ static void *run_threadPI(_thread_protoPI fn, void *arg1, 
int arg2)
        pthread_t tid;
        void *ret;
 
-        if(likely(ksr_tls_threads_mode == 0 || (ksr_tls_threads_mode == 1 && 
process_no > 0))) {
-            return fn(arg1, arg2);
-        }
+       if(likely(ksr_tls_threads_mode == 0
+                          || (ksr_tls_threads_mode == 1 && process_no > 0))) {
+               return fn(arg1, arg2);
+       }
 
        pthread_create(&tid, NULL, (_thread_proto)&run_thread_wrapPI,
                        &(struct _thread_argsPI){fn, arg1, arg2});
@@ -86,7 +88,7 @@ static void *run_threadPI(_thread_protoPI fn, void *arg1, int 
arg2)
 
        return ret;
 #else
-        return fn(arg1, arg2);
+       return fn(arg1, arg2);
 #endif
 }
 #endif
@@ -111,15 +113,17 @@ static void run_threadV(_thread_protoV fn)
 #ifdef USE_TLS
        pthread_t tid;
 
-        if(likely(ksr_tls_threads_mode == 0 || (ksr_tls_threads_mode == 1 && 
process_no > 0))) {
-            fn();
-        }
+       if(likely(ksr_tls_threads_mode == 0
+                          || (ksr_tls_threads_mode == 1 && process_no > 0))) {
+               fn();
+               return;
+       }
 
        pthread_create(&tid, NULL, (_thread_proto)run_thread_wrapV,
                        &(struct _thread_argsV){fn});
        pthread_join(tid, NULL);
 #else
-        fn();
+       fn();
 #endif
 }
 #endif
@@ -148,16 +152,17 @@ static int run_thread4PP(_thread_proto4PP fn, void *arg1, 
void *arg2)
        pthread_t tid;
        int ret;
 
-        if(likely(ksr_tls_threads_mode == 0 || (ksr_tls_threads_mode == 1 && 
process_no > 0))) {
-            return fn(arg1, arg2);
-        }
+       if(likely(ksr_tls_threads_mode == 0
+                          || (ksr_tls_threads_mode == 1 && process_no > 0))) {
+               return fn(arg1, arg2);
+       }
        pthread_create(&tid, NULL, (_thread_proto)run_thread_wrap4PP,
                        &(struct _thread_args4PP){fn, arg1, arg2, &ret});
        pthread_join(tid, NULL);
 
        return ret;
 #else
-        return fn(arg1, arg2);
+       return fn(arg1, arg2);
 #endif
 }
 #endif
@@ -183,14 +188,16 @@ static void run_thread0P(_thread_proto0P fn, void *arg1)
 #ifdef USE_TLS
        pthread_t tid;
 
-        if(likely(ksr_tls_threads_mode == 0 || (ksr_tls_threads_mode == 1 && 
process_no > 0))) {
-            fn(arg1);
-        }
+       if(likely(ksr_tls_threads_mode == 0
+                          || (ksr_tls_threads_mode == 1 && process_no > 0))) {
+               fn(arg1);
+               return;
+       }
        pthread_create(&tid, NULL, (_thread_proto)run_thread_wrap0P,
                        &(struct _thread_args0P){fn, arg1});
        pthread_join(tid, NULL);
 #else
-        fn(arg1)
+       fn(arg1)
 #endif
 }
 #endif

_______________________________________________
Kamailio (SER) - Development Mailing List
To unsubscribe send an email to sr-dev-le...@lists.kamailio.org

Reply via email to