You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
refactor(buffer_pool): remove mutex, single-thread by contract
All allocate_buffer() / free_disk_buffer() entry points are reached only
from the libtorrent network thread:
- allocate_buffer() is called from async_read/write/hash before posting
work to a worker thread.
- free_disk_buffer() runs from disk_buffer_holder's destructor, which
fires either when libtorrent invokes the handler (network thread per
disk_interface contract) or when our own handler lambda is posted
back to m_ioc.
libtorrent's session runs a single std::thread on the io_context
(session.cpp:342, only .run() call site in the source), and EZIO uses
the default internal_executor session, so the contract holds.
Drop m_pool_mutex and the lock-passing in allocate_buffer_impl /
check_buffer_level. in_use() may still be read from the stats thread;
the racy read is tolerated for reporting purposes. Document the
contract in buffer_pool.hpp.
Signed-off-by: Date Huang <tjjh89017@hotmail.com>