blob: e226f172696c00f010c39b181afc16e05527aba0 (
plain)
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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
|
/**** POSIX *******************************************************************/
#include <pthread.h>
#include <string.h>
/**** RELABSD *****************************************************************/
#include <relabsd/debug.h>
#include <relabsd/server.h>
/******************************************************************************/
/**** LOCAL FUNCTIONS *********************************************************/
/******************************************************************************/
/* TODO: implement. */
/*
void main_loop (struct relabsd_server server [const static 1])
{
}
*/
void * posix_main_loop (void * params)
{
/* main_loop((struct relabsd_server *) params);*/
params = NULL;
return params;
}
/******************************************************************************/
/**** EXPORTED FUNCTIONS ******************************************************/
/******************************************************************************/
int relabsd_server_create_communication_thread
(
struct relabsd_server server [const static 1]
)
{
int err;
err =
pthread_create
(
&(server->communication_thread),
(const pthread_attr_t *) NULL,
posix_main_loop,
(void *) server
);
if (err != 0)
{
RELABSD_FATAL
(
"Unable to create the communication thread: %s",
strerror(err)
);
return -1;
}
return 0;
}
int relabsd_server_join_communication_thread
(
struct relabsd_server server [const static 1]
)
{
int err;
err = pthread_join(server->communication_thread, (void **) NULL);
if (err != 0)
{
RELABSD_FATAL
(
"Unable to join with the communication thread: %s",
strerror(err)
);
return -1;
}
return 0;
}
|