summaryrefslogtreecommitdiff
path: root/main.cpp
blob: 2c0ada73246fa492cca968e5cb5610d78237eefd (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
#include "music.h"
#include "decoder.h"
#include "encoder.h"
#include "httpd.h"

#include <iostream>
#include <vector>

#include <boost/thread.hpp>

int main(int argc, char **argv) {
	try {
		music::init(argv[1]);
		decoder::init();
		encoder::init();

		boost::asio::io_service io_service;
		HTTPServer httpd(io_service);
		std::vector<boost::shared_ptr<boost::thread> > threads;
		for(std::size_t i = 0; i < 10; i++) {
			boost::shared_ptr<boost::thread> thread(new boost::thread(boost::bind(&boost::asio::io_service::run, &io_service)));
			threads.push_back(thread);
		}
		for(std::size_t i = 0; i < 10; i++) {
			threads[i]->join();
		}
	} catch(std::exception& e) {
		std::cerr << e.what() << std::endl;
	}

	return 0;
}