701
General Mach Discussion / Re: losing probe signals with USB game controller?
« on: February 07, 2010, 02:21:34 PM »Putting a Sleep(200) between the write and read should also guarantee a UI update has occurred.
This is misleading, and doesn't GUARANTEE anything. isMoving() tests a semaphore and while isMoving() wend repeatedly tests the semaphore. It is only when Mach sets this semaphore and VB reads that fact that it is "safe" to continue. A sleep(X) on its own is at best a "guess" and within the while isMoving() wend loop only serves to takes a little load off the CPU. The ONLY way to GUARANTEE synchronisation of asynchronous threads is via semaphores and the only way of reading this particular semaphore is via isMoving().
Cheers
Ian
Ian,
Could well be you know something I don't, but neither Art nor Brian has ever indicated to me that IsMoving() is a *guarantee* of a UI update. In fact, on occasion, Brian has suggested using a delay. Certainly, if the machine is idle, a delay of 2X the update rate *should* guarantee an update has occurred, as UI updates are regular, timed events, unless the machine is too busy running a program. But, as I said, v4 will be FAR better in this respect. It is a little ridiculous for user to have to worry about this kind of stuff.
Regards,
Ray L.