summaryrefslogtreecommitdiffstats
path: root/friendfinder/handler.c
blob: 8d15ed7083782b4c9686dafc92df98915969b3a3 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
#include "pthread.h"

#include "msg_sender.h"
#include "sender.h"
#include "receiver.h"
#include "handler.h"

pthread_t msg_thread, sender_thread, receiver_thread;


void init_msg_thread(char *from, char *to)
{
	struct nick *nicknames = (struct nick*) malloc(sizeof(struct nick));
	nicknames->from = from;
	nicknames->to = to;

	pthread_create(&msg_thread, NULL, msg_main_loop, (void*) nicknames);
}

void init_receiver_thread(char *from)
{
	pthread_create(&sender_thread, NULL, sender_main, (void*) from);
}

void init_sender_thread(char *from)
{
	pthread_create(&receiver_thread, NULL, receiver_main, (void*) from);
}

void close_threads()
{
	pthread_exit(NULL);
}