Results 1 to 3 of 3

Thread: WFD Error Codes Thread Safe?

  1. #1
    Join Date
    Mar 2011

    WFD Error Codes Thread Safe?

    It seems to me that the following sequence:

    Code :
                 wfdAnyFunction1( );  // Any arbitrary wfd function call
                 errorCode1 = wfdGetError( device );
    Code :
                 wfdAnyFunction2( );  // Any arbitrary wfd function call
                 errorCode2 = wfdGetError( device );
    is NOT thread safe when threads are using the same device.
    Itís possible that the value of errorCode1 could actually belong to Thread2 or the errorCode2 value could belong to Thread1.
    Am I missing something? Is the WFD client required to serialize access to the WFD driver to ensure error codes are correctly interpreted?

  2. #2
    Junior Member
    Join Date
    Feb 2010

    Re: WFD Error Codes Thread Safe?


    The OpenWFD specification states that:

    "The wfdGetError function returns the oldest error code provided by an API call on device since the previous call to wfdGetError on that device", and also "After the call, the error code is cleared to 0"

    This is similar to other Khronos standards in that only the oldest error is stored and the error is reset when read. Where the OpenWF APIs depart from the previous Khronos standards is that the error code (and other object data) is intended to be stored in process storage versus thread local storage. In other words, there is only one error code for the object versus one error code per thread interacting with the API. As I recall this was done deliberately with the desire to prevent some of the issues that occur when a thread maintains the state of an interaction with the API.

    In any case, I'm not sure this is a thread safety issue as much as a single process-wide error code handling issue. I see your point, though. Hopefully you will see that the benefits of process-wide object data when abstracting a single purpose hardware block out-weights the occasional nuisance of a common error code.


  3. #3
    Join Date
    Mar 2011

    Re: WFD Error Codes Thread Safe?

    Hi Steve:

    Thanks for your reply.
    I suppose there was a reason for not doing it but if functions returned WFDErrorCode directly the error code problem could be avoided.


Similar Threads

  1. Replies: 16
    Last Post: 04-15-2011, 04:12 PM
  2. is clGetEventInfo thread-safe?
    By diegor in forum OpenCL
    Replies: 0
    Last Post: 12-02-2009, 03:55 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
Proudly hosted by Digital Ocean