Skip to content

Commit

Permalink
Revert ed9d7bc - split into per module commits
Browse files Browse the repository at this point in the history
  • Loading branch information
space88man committed Feb 26, 2024
1 parent ed9d7bc commit f850f4e
Show file tree
Hide file tree
Showing 4 changed files with 3 additions and 51 deletions.
38 changes: 0 additions & 38 deletions src/core/rthreads.h
Original file line number Diff line number Diff line change
Expand Up @@ -254,41 +254,3 @@ static int run_thread4P5I2P2(_thread_proto4P5I2P2 fn, void *arg1, void *arg2,
#endif
}
#endif

/*
* prototype: CURLcode curl_global_init(long flags) { ... }
*/
#ifdef KSR_RTHREAD_NEED_4L
typedef int (*_thread_proto4L)(long);
struct _thread_args4L
{
_thread_proto4L fn;
long arg1;
int *ret;
};
static void *run_thread_wrap4L(struct _thread_args4L *args)
{
*args->ret = (*args->fn)(args->arg1);
return NULL;
}

static int run_thread4L(_thread_proto4L fn, long arg1)
{
#ifdef USE_TLS
pthread_t tid;
int ret;

if(likely(ksr_tls_threads_mode == 0
|| (ksr_tls_threads_mode == 1 && process_no > 0))) {
return fn(arg1);
}
pthread_create(&tid, NULL, (_thread_proto)run_thread_wrap4L,
&(struct _thread_args4L){fn, arg1, &ret});
pthread_join(tid, NULL);

return ret;
#else
return fn(arg1)
#endif
}
#endif
6 changes: 1 addition & 5 deletions src/modules/http_async_client/http_multi.c
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,6 @@
#include "../../core/mem/mem.h"
#include "../../core/ut.h"
#include "../../core/hashes.h"
#define KSR_RTHREAD_NEED_4L
#define KSR_RTHREAD_SKIP_P
#include "../../core/rthreads.h"
#include "http_multi.h"

extern int hash_size;
Expand Down Expand Up @@ -392,8 +389,7 @@ void set_curl_mem_callbacks(void)
break;
case 1:
LM_DBG("Initilizing cURL with sys malloc\n");
rc = run_thread4L(
(_thread_proto4L)curl_global_init, CURL_GLOBAL_ALL);
rc = curl_global_init(CURL_GLOBAL_ALL);
if(rc != 0) {
LM_ERR("Cannot initialize cURL: %d\n", rc);
}
Expand Down
5 changes: 1 addition & 4 deletions src/modules/http_client/http_client.c
Original file line number Diff line number Diff line change
Expand Up @@ -64,9 +64,6 @@
#include "../../core/lvalue.h"
#include "../../core/pt.h" /* Process table */
#include "../../core/kemi.h"
#define KSR_RTHREAD_NEED_4L
#define KSR_RTHREAD_SKIP_P
#include "../../core/rthreads.h"

#include "functions.h"
#include "curlcon.h"
Expand Down Expand Up @@ -281,7 +278,7 @@ static int mod_init(void)
LM_DBG("init curl module\n");

/* Initialize curl */
if(run_thread4L((_thread_proto4L)&curl_global_init, CURL_GLOBAL_ALL)) {
if(curl_global_init(CURL_GLOBAL_ALL)) {
LM_ERR("curl_global_init failed\n");
return -1;
}
Expand Down
5 changes: 1 addition & 4 deletions src/modules/xcap_client/xcap_client.c
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,6 @@
#include "../../core/mem/shm_mem.h"
#include "../../core/rpc.h"
#include "../../core/rpc_lookup.h"
#define KSR_RTHREAD_NEED_4L
#define KSR_RTHREAD_SKIP_P
#include "../../core/rthreads.h"
#include "../presence/utils_func.h"
#include "xcap_functions.h"
#include "xcap_client.h"
Expand Down Expand Up @@ -143,7 +140,7 @@ static int mod_init(void)
xcap_dbf.close(xcap_db);
xcap_db = NULL;

run_thread4L((_thread_proto4L)curl_global_init, CURL_GLOBAL_ALL);
curl_global_init(CURL_GLOBAL_ALL);

if(periodical_query) {
register_timer(query_xcap_update, 0, query_period);
Expand Down

0 comments on commit f850f4e

Please sign in to comment.