Files
PINRemoteImage/Pod/Classes
Garrett Moon 2cfc232d11 Adds better support for cancelation (#218)
In order to avoid blocking on the main thread, PINRemoteImage creates
a UUID but does not immediately start a task instead putting it on an
operation queue. This means that a client can request cancelation for
a UUID before its task is created.

Previously, we attempted to handle this by maintaining a set of canceled
UUIDs. This was being done incorrectly however. The logic was to check if,
before creating a task, a UUID was in canceledTasks. If it was, don't
create the task. If it wasn't clear out the canceledTasks list. This
example illustrates why that was erroneous:
1. Request starting a task with UUID #1
2. Request starting a task with UUID #2
3. Request canceling UUID #2
4. Task creation starts for UUID #1
5. UUID one is not in canceledTasks so it is cleared
6. Task creation starts for UUID #2, it is not in canceledTasks
   so the task is created and is not canceled.

This patch changes canceledTasks to a weak hash table and removes
the line which cleared out canceledTasks. As long as there are blocks
(for task creation) referencing the UUID, they will not be removed
from canceledTasks. When no one is referencing the UUIDs any longer,
they will be cleared out.
2016-07-15 14:51:48 -07:00
..
2016-03-22 22:02:27 -07:00
1.0
2015-07-22 17:29:31 -07:00
1.0
2015-07-22 17:29:31 -07:00
1.0
2015-07-22 17:29:31 -07:00
2016-03-20 17:47:25 -07:00