forked from uchuugaka/libwebsock-1
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathlibevent_integration_testing.c
More file actions
35 lines (24 loc) · 919 Bytes
/
libevent_integration_testing.c
File metadata and controls
35 lines (24 loc) · 919 Bytes
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
#include <pthread.h>
#include <stdio.h>
#include <websock/websock.h>
void *WebsockWait();
int main() {
pthread_t one,two,three,four;
int one1,two2,three3,four4;
libwebsock_context *ctx = libwebsock_init(NULL,NULL,1024);
libwebsock_context *ctx2 = libwebsock_init(ctx->base,NULL,1024);
libwebsock_context *ctx3 = libwebsock_init(ctx->base,NULL,1024);
libwebsock_context *ctx4 = libwebsock_init(ctx->base,NULL,1024);
one1 = pthread_create(&one, NULL, WebsockWait, ctx);
two2 = pthread_create(&two, NULL, WebsockWait, ctx2);
three3 = pthread_create(&three, NULL, WebsockWait, ctx3);
four4 = pthread_create(&four, NULL, WebsockWait, ctx4);
pthread_join(one,NULL);
return 0;
}
void *WebsockWait(void *arg) {
libwebsock_context *ptr = arg;
libwebsock_bind_socket(ptr, *ptr->socketfd);
libwebsock_wait(ptr);
return 0;
}