Results 1 to 3 of 3

Thread: Callback When Event Already Set?

  1. #1
    Junior Member
    Join Date
    Dec 2011
    Posts
    1

    Callback When Event Already Set?

    Quick question regarding event callbacks: if an event is already set at the time clSetEventCallback is called to register a callback, will the callback be called? The specific scenario I have in mind is this (this is all in one function):

    1. Enqueue something and get an event
    2. Queued item begins executing on its own, and completes
    3. clSetEventCallback is called for said event (in the code this is right after #1)
    4. Do I need to call clGetEventInfo to enure the event wasn't already set prior to #3, or will the callback be called at some point in the future??

  2. #2

    Re: Callback When Event Already Set?

    The spec says "All callbacks registered for an event object must be called. All enqueued callbacks shall be called before the event object is destroyed." Bottom line, even though the event may have progressed to a later state, the callback is guaranteed to be called for the state it is being register for. In other words, if you register a callback for CL_COMPLETE, but the event is already completed, then during the act of registering the callback will be called.

  3. #3
    Junior Member
    Join Date
    Apr 2010
    Location
    Perth, WA
    Posts
    27

    Re: Callback When Event Already Set?

    I had this exact same query, so I read the spec and was horribly confused.

    Yes, the spec says, "All callbacks registered for an event object must be called.", but it also says "The registered callback function will be called when the execution status of command associated with event changes to the execution status specified by command_exec_status."

    So which is it? Called only on the transition to the specified status or called regardless of a transition?

    For what is such a simple concept, the standard uses wording that has far to much wiggle room. I'm worried that different implementations may behave wildly differently.

    I will work on the assumption that all callbacks will be called back in a timely manner (say, millisecond dealys at most) in both cases - a transition to CL_COMPLETED and a registration of a callback to an already completed event.

    Cheers,

    Dan
    Daniel Paull
    Real Engineers Think Bottom Up.

Similar Threads

  1. Replies: 0
    Last Post: 04-10-2012, 03:40 PM
  2. Events and callback functions
    By zhugh in forum OpenCL
    Replies: 4
    Last Post: 12-12-2010, 06:55 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •