Commit d1659e38 authored by Ghislain MARY's avatar Ghislain MARY

Threads are no longer needed.

parent 1094abe5
......@@ -261,9 +261,9 @@ unsigned long belle_sip_resolve(belle_sip_stack_t *stack, const char *name, int
return 0;
}
/*the resolver context must never be removed manually from the main loop*/
/* The resolver context must never be removed manually from the main loop */
belle_sip_main_loop_add_source(ml,(belle_sip_source_t*)ctx);
belle_sip_object_unref(ctx);/*the main loop and the thread have a ref on it*/
belle_sip_object_unref(ctx); /* The main loop has a ref on it */
return ctx->source.id;
} else {
cb(data, name, res);
......
......@@ -42,37 +42,6 @@ void belle_sip_uninit_sockets(void){
if (sockets_initd==0) WSACleanup();
}
typedef struct thread_param{
void * (*func)(void *);
void * arg;
}thread_param_t;
static unsigned WINAPI thread_starter(void *data){
thread_param_t *params=(thread_param_t*)data;
void *ret=params->func(params->arg);
belle_sip_free(data);
return (DWORD)ret;
}
int belle_sip_thread_create(belle_sip_thread_t *th, void *attr, void * (*func)(void *), void *data)
{
thread_param_t *params=belle_sip_new(thread_param_t);
params->func=func;
params->arg=data;
*th=(HANDLE)_beginthreadex( NULL, 0, thread_starter, params, 0, NULL);
return 0;
}
int belle_sip_thread_join(belle_sip_thread_t thread_h, void **unused)
{
if (thread_h!=NULL)
{
WaitForSingleObject(thread_h, INFINITE);
CloseHandle(thread_h);
}
return 0;
}
int belle_sip_socket_set_nonblocking (belle_sip_socket_t sock)
{
unsigned long nonBlock = 1;
......
......@@ -28,7 +28,6 @@
#include <netdb.h>
#include <arpa/inet.h>
#include <netinet/tcp.h>
#include <pthread.h>
#else
......@@ -104,27 +103,6 @@ static inline int get_socket_error(void){
#endif
/*
* Thread abstraction layer
*/
#ifdef WIN32
typedef HANDLE belle_sip_thread_t;
int belle_sip_thread_join(belle_sip_thread_t thread, void **retptr);
int belle_sip_thread_create(belle_sip_thread_t *thread, void *attr, void * (*routine)(void*), void *arg);
#else
#include <pthread.h>
typedef pthread_t belle_sip_thread_t;
#define belle_sip_thread_join(thread,retptr) pthread_join(thread,retptr)
#define belle_sip_thread_create(thread,attr,routine,arg) pthread_create(thread,attr,routine,arg)
#endif
#endif
......
......@@ -19,7 +19,6 @@
#include <stdio.h>
#include "CUnit/Basic.h"
#include "belle-sip/belle-sip.h"
#include "pthread.h"
extern belle_sip_stack_t * stack;
extern belle_sip_provider_t *prov;
......
......@@ -19,7 +19,6 @@
#include <stdio.h>
#include "CUnit/Basic.h"
#include "belle-sip/belle-sip.h"
#include "pthread.h"
const char *test_domain="test.linphone.org";
const char *auth_domain="sip.linphone.org";
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment