title: Grand Central Dispatch (GCD) dispatch source flags
body: <p>I recently switched from using <a href="http://www.freebsd.org/cgi/man.cgi?query=kqueue&amp;apropos=0&amp;sektion=0&amp;format=html" rel="nofollow noreferrer">kqueue</a> to <a href="https://developer.apple.com/documentation/dispatch/1385630-dispatch_source_create" rel="nofollow noreferrer">GCD dispatch sources</a> to monitor file changes. This has worked out well and resulted in a much simpler API. I documented my switch <a href="https://web.archive.org/web/20170825044413/http://www.davidhamrick.com/2011/10/10/handling-filesystem-events-with-gcd.html" rel="nofollow noreferrer">here</a>. The only issue I have is that now I cannot access the flags on the event that I was able to in kqueue. For example with kqueue I was able to check if the file was deleted, renamed, or it's attributes were changed with the following:</p>
  
  <pre><code>struct kevent event;
  
  ...
  
  if(event.flag &amp; EV_DELETE)
  {
      printf("File was deleted\n");
  }
  </code></pre>
  
  <p>Is this API not available with GCD or do I need to set up dispatch sources up for each flag I would like to listen to. Or is it best to use kqueue since it provides greater visibility to the event that has occurred.</p>