aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/src/worker.h
blob: 0bf3e8001591fdcf8c8a4738eead0b290e6f64a7 (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
/*
 * Copyright (c) 2022 Egor Tensin <Egor.Tensin@gmail.com>
 * This file is part of the "cimple" project.
 * For details, see https://github.com/egor-tensin/cimple.
 * Distributed under the MIT License.
 */

#ifndef __WORKER_H__
#define __WORKER_H__

#include <pthread.h>

struct settings {
	char *host;
	char *port;
};

struct worker {
	int fd;

	pthread_mutex_t task_mtx;
	pthread_t task;
	int task_active;
};

int worker_create(struct worker *, const struct settings *);
void worker_destroy(struct worker *);

int worker_main(struct worker *, int argc, char *argv[]);

#endif