WaitForXfer function

Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
WGT_4383351
Level 5
Level 5
First like received

What doesn WaitForXfer do? Is there source code?

Can WaitForXfer be replaced by other Windows wait functions, like WaitForMultipleObjects?

0 Likes
1 Solution

Hello,

You can get the source code from https://www.cypress.com/documentation/software-and-drivers/ez-usb-fx3-software-development-kit CyUSB3_USB_Suite_Source.zip.

The waitforXfer API is executed using WaitForSingleObject

        public bool WaitForXfer(IntPtr ovlapEvent, uint tOut)

        {

           

            Int32 waitResult = PInvoke.WaitForSingleObject(ovlapEvent, tOut);

            if (waitResult == CyConst.WAIT_OBJECT_0)

            {

                return true;

            }           

            return false;

        }

Please let me know if any queries on this

Regards,

Rashi

Regards,
Rashi

View solution in original post

0 Likes
3 Replies
Rashi_Vatsa
Moderator
Moderator
Moderator
5 likes given 500 solutions authored 1000 replies posted

Hello,

WaitForXfer is generally used for asynchronous transfers unlike XferData .You will usually want to use the synchronous XferData method rather than the asynchronous BeginDataXfer/WaitForXfer/FinishDataXfer approach.

Correct me if i am wrong, as per my understanding of WaitForMultipleObjects function determines whether the wait criteria have been met. If the criteria have not been met, the calling thread enters the wait state until the conditions of the wait criteria have been met or the time-out interval elapses. This might not involve usb transfer.

Regards,

Rashi

Regards,
Rashi
0 Likes

I need to use asynchronous IO.

Internally WaitForXfer should call something like WaitForSingleObject, can you check this?

Your understanding is right. Besides WaitForMultipleObjects can wait for multiple objects (one of them is the CYUSB OVERLAPPED object) and returns when any of them is ready, this is what is needed. This is why WaitForMultipleObjects should be used instead of WaitForXfer - WaitForXfer can only wait for the OVERLAPPED object of CYUSB object internally.

Can you check what WaitForXfer do besides WaitForSingleObject?

Or can other wait functions like WaitForMultipleObjects be put before WaitForXfer?

0 Likes

Hello,

You can get the source code from https://www.cypress.com/documentation/software-and-drivers/ez-usb-fx3-software-development-kit CyUSB3_USB_Suite_Source.zip.

The waitforXfer API is executed using WaitForSingleObject

        public bool WaitForXfer(IntPtr ovlapEvent, uint tOut)

        {

           

            Int32 waitResult = PInvoke.WaitForSingleObject(ovlapEvent, tOut);

            if (waitResult == CyConst.WAIT_OBJECT_0)

            {

                return true;

            }           

            return false;

        }

Please let me know if any queries on this

Regards,

Rashi

Regards,
Rashi
0 Likes