示例#1
0
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;
}
示例#2
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
}
示例#5
0
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);
}
示例#6
0
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
}
示例#7
0
 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>();
 }
示例#8
0
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
}
示例#9
0
void torrent_handle::reset_piece_deadline(int index) const
{
    async_call(&torrent::reset_piece_deadline, index);
}
示例#10
0
void torrent_handle::super_seeding(bool on) const
{
    async_call(&torrent::set_super_seeding, on);
}
示例#11
0
void torrent_handle::force_reannounce(int s, int idx) const
{
    async_call(&torrent::force_tracker_request, aux::time_now() + seconds(s), idx);
}
示例#12
0
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);
}
示例#13
0
void torrent_handle::read_piece(int piece) const
{
    async_call(&torrent::read_piece, piece);
}
示例#14
0
void torrent_handle::replace_trackers(
    std::vector<announce_entry> const& urls) const
{
    async_call(&torrent::replace_trackers, urls);
}
示例#15
0
void torrent_handle::prioritize_pieces(std::vector<int> const& pieces) const
{
    async_call(&torrent::prioritize_pieces, pieces);
}
示例#16
0
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());
}
示例#17
0
void torrent_handle::remove_http_seed(std::string const& url) const
{
    async_call(&torrent::remove_web_seed, url, web_seed_entry::http_seed);
}
示例#18
0
void torrent_handle::prioritize_pieces(std::vector<std::pair<int, int> > const& pieces) const
{
    async_call(&torrent::prioritize_piece_list, pieces);
}
示例#19
0
void torrent_handle::add_tracker(announce_entry const& url) const
{
    async_call(&torrent::add_tracker, url);
}
示例#20
0
void torrent_handle::file_priority(int index, int priority) const
{
    async_call(&torrent::set_file_priority, index, priority);
}
示例#21
0
void torrent_handle::connect_peer(tcp::endpoint const& adr, int source, int flags) const
{
    async_call(&torrent::add_peer, adr, source, flags);
}
示例#22
0
void torrent_handle::prioritize_files(std::vector<int> const& files) const
{
    async_call(&torrent::prioritize_files, files);
}
示例#23
0
void torrent_handle::force_dht_announce() const
{
#ifndef TORRENT_DISABLE_DHT
    async_call(&torrent::dht_announce);
#endif
}
示例#24
0
void torrent_handle::use_interface(const char* net_interface) const
{
    async_call(&torrent::use_interface, std::string(net_interface));
}
示例#25
0
void torrent_handle::scrape_tracker(int idx) const
{
    async_call(&torrent::scrape_tracker, idx, true);
}
示例#26
0
void torrent_handle::filter_piece(int index, bool filter) const
{
    async_call(&torrent::filter_piece, index, filter);
}
示例#27
0
void torrent_handle::set_piece_deadline(int index, int deadline, int flags) const
{
    async_call(&torrent::set_piece_deadline, index, deadline, flags);
}
示例#28
0
void torrent_handle::filter_pieces(std::vector<bool> const& pieces) const
{
    async_call(&torrent::filter_pieces, pieces);
}
示例#29
0
void torrent_handle::clear_piece_deadlines() const
{
    async_call(&torrent::clear_time_critical);
}
示例#30
0
void torrent_handle::filter_files(std::vector<bool> const& files) const
{
    auto filesr= std::ref(files);
    async_call(&torrent::filter_files, filesr);
}