Added queue label as a third argument to the designated init method #4

Merged
merged 4 commits into from May 30, 2012

Conversation

Projects
None yet
3 participants
Contributor

mz2 commented May 16, 2012

The queue label is handy for debugging purposes (debugger and crash reports present it), hence made it possible to set it.

mz2 and others added some commits May 16, 2012

Made MABGTimer work in a garbage collected environment, and ensure th…
…at -dealloc and -finalize effectively wait for _queue to clear to avoid threading crashes (by calling [self _cancel] which dispatches synchronously to _queue cancellation of the dispatch source, and releasing of it), only then releases the queue.
Contributor

mz2 commented May 17, 2012

Added some more new stuff and bug fixes. MABGTimer now:

  1. works in a garbage collected environment (-finalize added, does the same stuff as -dealloc).
  2. cancels the dispatch source synchronously using _queue, and releases it before releasing the dispatch queue (call [self _cancel] in -dealloc and -finalize, which synchronizes the cancellation + releasing using _queue).
  3. made the object property __unsafe_unretained, to avoid a retain cycle in case object happens to be the object that owns the timer object (which wouldn't make sense as a weak pointer).

mikeash added a commit that referenced this pull request May 30, 2012

Merge pull request #4 from mz2/master
Add ability to label the queue, GC support, and avoid retain cycles in ARC

@mikeash mikeash merged commit 75a0767 into mikeash:master May 30, 2012

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment