Developers.Mike.HowShareazaUsesThreads: Difference between revisions
m (1 revision) |
No edit summary |
||
Line 1: | Line 1: | ||
===How Shareaza Uses Threads=== | ===How Shareaza Uses Threads=== | ||
''Mike'' from '''http:// | ''Mike'' from '''http://xxx/showthread.php?threadid=31621#post194111''' (thread has been lost) | ||
Regarding threading, Shareaza has a number of threads: | Regarding threading, Shareaza has a number of threads: | ||
Line 37: | Line 37: | ||
- Finally, often when a simple "web service" style HTTP request is executed, a temporary thread manages this process - for example a Bitzi request, downloading a server.met file, etc | - Finally, often when a simple "web service" style HTTP request is executed, a temporary thread manages this process - for example a Bitzi request, downloading a server.met file, etc | ||
[[Category:External Links]] |
Latest revision as of 23:03, 21 February 2010
Mike from http://xxx/showthread.php?threadid=31621#post194111 (thread has been lost)
Regarding threading, Shareaza has a number of threads:
PRIMARY threads that are (almost) always present:
- The initial / main / GUI thread
- A handshakes thread that services inbound connections (handshakes) until such time as their purpose is known (G1/2 peer, push download, upload, chat, eDonkey client, BitTorrent coupling)
- A network/connectivity thread that services neighbour (P2P network) connections, manages UDP transmission and reception, client side P2P searches and query hash merging & propagation
- A transfer (download/upload) thread that services download and upload connections, both received and initiated - this also includes eDonkey client links and BitTorrent couplings, both of which can be bidirectional. Note that part of its download servicing duties involves doing the in-progress download verification.
- A library thread that patrolls the library folders and identifies file additions, removals, changes, etc, and updates the associated internal data structures - uses directory change notifications to avoid polling where it can
Threads that are created on demand:
- A library builder thread that "builds the library", which means hashing files and extracting internal metadata from them (e.g. ID3, etc), which is done together. I believe recent hashing improvements might even involve several concurrent threads performing this task on certain CPUs?
- A chat thread that services inbound and outbound chat session connections
- A discovery service thread that executes a request on a discovery service
- A download task thread is created to execute a discrete download task such as preallocating a large file (for BitTorrent), or moving a file after the download is complete - for BitTorrent this can involve "unpacking" the tar into its constituent files. The main transfers thread can't really do these things because it needs to be free to continue other download/uploads
- Several GUI components create a thread, including the library metadata panel, the library thumbnail view and the library tip. These all use a thread to generate and cache or load from cache, a single thumbnail or many thimbnails of the selected file or files for display
- Similarly the search detail/metadata panel uses a thread to execute the remote preview operation if available - although this kind of falls into the "HTTP catchall" mentioned below
- Copying or moving a file within the Shareaza library invokes a thread to do the copying and moving, such that the GUI thread remains responsive (and can cancel it)
- Previewing an in-progress download using a preview plugin (e.g. MP3, AVI, MPEG if enabled) invokes a thread to do the preview, so that the GUI thread remains responsive (and can cancel it)
- Seeding a torrent invokes a thread to locate the source file(s) and verify the complete file(s) against the .torrent hash information
- Finally, often when a simple "web service" style HTTP request is executed, a temporary thread manages this process - for example a Bitzi request, downloading a server.met file, etc