Added mongoose library
This commit is contained in:
parent
cbbdcbaf78
commit
25da00b91e
5
Makefile
5
Makefile
|
@ -1,7 +1,10 @@
|
||||||
|
|
||||||
|
|
||||||
main:
|
main:
|
||||||
$(CC) main.c -o main -lmongoose -O2 $(CFLAGS)
|
$(CC) main.c mongoose.c -o main -I. -O2 $(CFLAGS)
|
||||||
|
|
||||||
|
anarchy:
|
||||||
|
$(CC) main.c mongoose.c -o main -I. -O2 -DALLOCATE_EVERYTHING=1 $(CFLAGS)
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
$(RM) main
|
$(RM) main
|
||||||
|
|
3
main.c
3
main.c
|
@ -66,13 +66,14 @@ uint64_t next_block_number = 0;
|
||||||
|
|
||||||
void api_handler(struct mg_connection *c, int ev, void *evd, void *fnd);
|
void api_handler(struct mg_connection *c, int ev, void *evd, void *fnd);
|
||||||
|
|
||||||
int main(void) {
|
int main(int argc, char **argv) {
|
||||||
struct mg_mgr manager;
|
struct mg_mgr manager;
|
||||||
mg_mgr_init(&manager);
|
mg_mgr_init(&manager);
|
||||||
mg_http_listen(&manager, "0.0.0.0:8080", api_handler, NULL);
|
mg_http_listen(&manager, "0.0.0.0:8080", api_handler, NULL);
|
||||||
|
|
||||||
#if ALLOCATE_EVERYTHING
|
#if ALLOCATE_EVERYTHING
|
||||||
int n_threads = 4;
|
int n_threads = 4;
|
||||||
|
if (argc >= 2) n_threads = atoi(argv[1]);
|
||||||
pthread_t *threads = calloc(n_threads, sizeof(pthread_t));
|
pthread_t *threads = calloc(n_threads, sizeof(pthread_t));
|
||||||
for (int i = 0; i < n_threads; i++)
|
for (int i = 0; i < n_threads; i++)
|
||||||
pthread_create(&threads[i], NULL, allocation_thread, NULL);
|
pthread_create(&threads[i], NULL, allocation_thread, NULL);
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue