aboutsummaryrefslogtreecommitdiff
path: root/src/evanix.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/evanix.c')
-rw-r--r--src/evanix.c24
1 files changed, 22 insertions, 2 deletions
diff --git a/src/evanix.c b/src/evanix.c
index dcac070..e83d0ea 100644
--- a/src/evanix.c
+++ b/src/evanix.c
@@ -1,12 +1,14 @@
#include <stdlib.h>
#include <string.h>
+#include "build.h"
#include "queue.h"
#include "util.h"
int main(void)
{
struct queue_thread *queue_thread = NULL;
+ struct build_thread *build_thread = NULL;
FILE *stream = NULL;
int ret = 0;
@@ -20,22 +22,40 @@ int main(void)
goto out_free;
}
+ ret = build_thread_new(&build_thread, queue_thread->queue);
+ if (ret < 0) {
+ free(stream);
+ goto out_free;
+ }
+
ret = pthread_create(&queue_thread->tid, NULL, queue_thread_entry,
queue_thread);
if (ret < 0) {
print_err("%s", strerror(ret));
- ret = -ret;
+ goto out_free;
+ }
+
+ ret = pthread_create(&build_thread->tid, NULL, build_thread_entry,
+ build_thread);
+ if (ret < 0) {
+ print_err("%s", strerror(ret));
goto out_free;
}
ret = pthread_join(queue_thread->tid, NULL);
if (ret < 0) {
print_err("%s", strerror(ret));
- ret = -ret;
+ goto out_free;
+ }
+
+ ret = pthread_join(build_thread->tid, NULL);
+ if (ret < 0) {
+ print_err("%s", strerror(ret));
goto out_free;
}
out_free:
queue_thread_free(queue_thread);
+ free(build_thread);
exit(ret < 0 ? EXIT_FAILURE : EXIT_SUCCESS);
}