int main(void) { pthread_mutex_init(&mutex_waiting, NULL); pthread_mutex_init(&mutex_leaving, NULL); pthread_mutex_init(&mutex_connected, NULL); pthread_mutex_init(&mutex_status, NULL); pthread_mutex_init(&mutex_pause, NULL); waiting_ferries.push(5); waiting_ferries.push(2); waiting_ferries.push(6); printf("Occupation des terminaux: \n"); for (int i = 0; i < 6; i++) { printf(" Terminal %d: %d\n", i+1, docked_ferries[i]); } async_call(status_server, NULL); async_call(terminal_server, NULL); async_call(admin_server, NULL); inout_server(NULL); pthread_mutex_destroy(&mutex_leaving); pthread_mutex_destroy(&mutex_waiting); pthread_mutex_destroy(&mutex_connected); pthread_mutex_destroy(&mutex_status); pthread_mutex_destroy(&mutex_pause); return 0; }
void torrent_handle::move_storage( std::wstring const& save_path, int flags) const { std::string utf8; wchar_utf8(save_path, utf8); async_call(&torrent::move_storage, utf8, flags); }
Result call( const fc::string& method, const variant& a1, const variant& a2, microseconds timeout = microseconds::maximum()) { return async_call( method, a1, a2 ).wait(timeout).as<Result>(); }
void async_worker_enter(async_worker_t *const worker) { assert(worker); assert(!worker->work); worker->work = co_active(); async_call(enter, worker); // Now on worker thread }
static void async_start(void) { async_t thread[1]; thread->fiber = co_active(); thread->flags = 0; active = thread; void (*const func)(void *) = arg_func; void *arg = arg_arg; func(arg); async_call(co_delete, thread->fiber); }
void torrent_handle::add_extension( boost::function<boost::shared_ptr<torrent_plugin>(torrent_handle const&, void*)> const& ext , void* userdata) { #ifndef TORRENT_DISABLE_EXTENSIONS async_call(&torrent::add_extension_fun, ext, userdata); #else TORRENT_UNUSED(ext); TORRENT_UNUSED(userdata); #endif }
Result call( const fc::string& method, const variant& a1, const variant& a2, const variant& a3, const variant& a4, const variant& a5, const variant& a6, const variant& a7, microseconds timeout = microseconds::maximum()) { return async_call( method, a1, a2, a3, a4, a5, a6, a7).wait(timeout).as<Result>(); }
void torrent_handle::set_ssl_certificate_buffer( std::string const& certificate , std::string const& private_key , std::string const& dh_params) { #ifdef TORRENT_USE_OPENSSL async_call(&torrent::set_ssl_cert_buffer, certificate, private_key, dh_params); #else TORRENT_UNUSED(certificate); TORRENT_UNUSED(private_key); TORRENT_UNUSED(dh_params); #endif }
void torrent_handle::reset_piece_deadline(int index) const { async_call(&torrent::reset_piece_deadline, index); }
void torrent_handle::super_seeding(bool on) const { async_call(&torrent::set_super_seeding, on); }
void torrent_handle::force_reannounce(int s, int idx) const { async_call(&torrent::force_tracker_request, aux::time_now() + seconds(s), idx); }
void torrent_handle::force_reannounce( boost::posix_time::time_duration duration) const { async_call(&torrent::force_tracker_request, aux::time_now() + seconds(duration.total_seconds()), -1); }
void torrent_handle::read_piece(int piece) const { async_call(&torrent::read_piece, piece); }
void torrent_handle::replace_trackers( std::vector<announce_entry> const& urls) const { async_call(&torrent::replace_trackers, urls); }
void torrent_handle::prioritize_pieces(std::vector<int> const& pieces) const { async_call(&torrent::prioritize_pieces, pieces); }
void torrent_handle::add_http_seed(std::string const& url) const { async_call(&torrent::add_web_seed, url, web_seed_entry::http_seed , std::string(), web_seed_entry::headers_t()); }
void torrent_handle::remove_http_seed(std::string const& url) const { async_call(&torrent::remove_web_seed, url, web_seed_entry::http_seed); }
void torrent_handle::prioritize_pieces(std::vector<std::pair<int, int> > const& pieces) const { async_call(&torrent::prioritize_piece_list, pieces); }
void torrent_handle::add_tracker(announce_entry const& url) const { async_call(&torrent::add_tracker, url); }
void torrent_handle::file_priority(int index, int priority) const { async_call(&torrent::set_file_priority, index, priority); }
void torrent_handle::connect_peer(tcp::endpoint const& adr, int source, int flags) const { async_call(&torrent::add_peer, adr, source, flags); }
void torrent_handle::prioritize_files(std::vector<int> const& files) const { async_call(&torrent::prioritize_files, files); }
void torrent_handle::force_dht_announce() const { #ifndef TORRENT_DISABLE_DHT async_call(&torrent::dht_announce); #endif }
void torrent_handle::use_interface(const char* net_interface) const { async_call(&torrent::use_interface, std::string(net_interface)); }
void torrent_handle::scrape_tracker(int idx) const { async_call(&torrent::scrape_tracker, idx, true); }
void torrent_handle::filter_piece(int index, bool filter) const { async_call(&torrent::filter_piece, index, filter); }
void torrent_handle::set_piece_deadline(int index, int deadline, int flags) const { async_call(&torrent::set_piece_deadline, index, deadline, flags); }
void torrent_handle::filter_pieces(std::vector<bool> const& pieces) const { async_call(&torrent::filter_pieces, pieces); }
void torrent_handle::clear_piece_deadlines() const { async_call(&torrent::clear_time_critical); }
void torrent_handle::filter_files(std::vector<bool> const& files) const { auto filesr= std::ref(files); async_call(&torrent::filter_files, filesr); }