Ignore:
Timestamp:
05/16/09 13:20:26 (10 years ago)
Author:
Eoin
Message:

Adding an asio based threadpool instead of manually try to approximate the behaviour.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/halSession.hpp

    r758 r759  
    963963private: 
    964964        bool create_torrent(const create_torrent_params& params, fs::wpath out_file, progress_callback fn); 
     965 
     966        void service_thread(size_t); 
     967        void alert_handler_wait(const boost::system::error_code& /*e*/); 
     968 
     969        boost::asio::io_service io_service_; 
     970        std::auto_ptr<boost::asio::io_service::work> work_; 
     971 
     972        void acquire_work_object() 
     973        { 
     974                HAL_DEV_MSG(hal::wform(L"Acquiring service work object.")); 
     975 
     976                work_.reset(new boost::asio::io_service::work(io_service_)); 
     977        } 
     978 
     979        void discard_work_object() 
     980        { 
     981                work_.reset(); 
     982 
     983                HAL_DEV_MSG(hal::wform(L"Discarded service work object")); 
     984        } 
    965985         
    966986        boost::optional<libt::session> session_;         
    967987        mutable mutex_t mutex_; 
    968988 
    969         boost::optional<thread_t> alert_checker_; 
    970         bool keepChecking_; 
     989        typedef boost::shared_ptr<thread_t> shared_thread_ptr; 
     990 
     991        std::vector<shared_thread_ptr> service_threads_; 
     992        bool keep_checking_; 
    971993         
    972994        ini_file bittorrent_ini_; 
     
    9961018        libt::upnp* upnp_; 
    9971019        libt::natpmp* natpmp_; 
    998  
    999         boost::asio::io_service io; 
    10001020}; 
    10011021 
Note: See TracChangeset for help on using the changeset viewer.