GSOC Day 59 – Threads and Multiple Downloads


Threads! Locks! Crazy progress bars jumping all over the place! All this and more in today’s episode of: Today in GSOC.

The sky was overcast and foreboding on this Tuesday afternoon, and the tension was so thick you could cut it with an old metaphor. The hours ticked lazily by as I read again over the threading and media library code, searching for something to change, to improve. At last, I saw it: an unnecessarily complicated if statement construction. I knew that I could make some progress if this could get me started.

Heartened by this first foray, I struck onward, making another breakthrough: I created a new class, a thread that would run a single download. The way was not clear yet, however; there were jungles of simultaneous access to cross. With the addition of a few clever locks and the movement of a few callbacks and parameters, I was able to… create a large mess of progress bars jumping back and forth and error messages streaming down the screen. Clearly, I had taken a misstep into the quicksand pit of threads. I quickly fashioned myself a rope of sorts, with a series of currently downloading files so that I would not repeatedly create threads to download the same file, and I pulled myself free of the muck. Finally, the simultaneous downloads could roam freely over the land!

I managed to catch a photograph of their frolicking:

The downloads living side by side in harmony.

The downloads living side by side in harmony.

I doubt not, however, that there will be further twists in this plot. Threads do not always live as easily side by side as they first appear to, and I will watch them carefully as I continue my research into checksums and file paths tomorrow.

Advertisements

~ by greywhind on July 21, 2009.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

 
%d bloggers like this: