"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "src/ec_threads.c" between
ettercap-0.8.3.tar.gz and ettercap-0.8.3.1.tar.gz

About: ettercap is a multipurpose sniffer/interceptor/logger for switched LAN.

ec_threads.c  (ettercap-0.8.3):ec_threads.c  (ettercap-0.8.3.1)
skipping to change at line 34 skipping to change at line 34
#include <pthread.h> #include <pthread.h>
#include <errno.h> #include <errno.h>
struct thread_list { struct thread_list {
struct ec_thread t; struct ec_thread t;
LIST_ENTRY (thread_list) next; LIST_ENTRY (thread_list) next;
}; };
/* global data */ /* global data */
/* a value to be used to return errors in fuctcions using pthread_t values */
static pthread_t EC_PTHREAD_NULL = 0;
#define EC_PTHREAD_SELF EC_PTHREAD_NULL
#define DETACHED_THREAD 1 #define DETACHED_THREAD 1
#define JOINABLE_THREAD 0 #define JOINABLE_THREAD 0
static LIST_HEAD(, thread_list) thread_list_head; static LIST_HEAD(, thread_list) thread_list_head;
static pthread_mutex_t threads_mutex = PTHREAD_MUTEX_INITIALIZER; static pthread_mutex_t threads_mutex = PTHREAD_MUTEX_INITIALIZER;
#define THREADS_LOCK do{ pthread_mutex_lock(&threads_mutex); } while(0) #define THREADS_LOCK do{ pthread_mutex_lock(&threads_mutex); } while(0)
#define THREADS_UNLOCK do{ pthread_mutex_unlock(&threads_mutex); } while(0) #define THREADS_UNLOCK do{ pthread_mutex_unlock(&threads_mutex); } while(0)
static pthread_mutex_t init_mtx = PTHREAD_MUTEX_INITIALIZER; static pthread_mutex_t init_mtx = PTHREAD_MUTEX_INITIALIZER;
skipping to change at line 96 skipping to change at line 101
/* /*
* returns the pid of a thread * returns the pid of a thread
* ZERO if not found !! (take care, not -E_NOTFOUND !) * ZERO if not found !! (take care, not -E_NOTFOUND !)
*/ */
pthread_t ec_thread_getpid(char *name) pthread_t ec_thread_getpid(char *name)
{ {
struct thread_list *current; struct thread_list *current;
pthread_t pid; pthread_t pid;
/*
* if "name" is explicitely set up NULL, the top-level pthread_t
* is returned w/o iterating through the thread-list
*/
if (name == NULL)
return EC_PTHREAD_NULL;
THREADS_LOCK; THREADS_LOCK;
LIST_FOREACH(current, &thread_list_head, next) { LIST_FOREACH(current, &thread_list_head, next) {
if (!strcasecmp(current->t.name,name)) { if (!strcasecmp(current->t.name,name)) {
pid = current->t.id; pid = current->t.id;
THREADS_UNLOCK; THREADS_UNLOCK;
return pid; return pid;
} }
} }
 End of changes. 2 change blocks. 
0 lines changed or deleted 12 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)