|Subject:||Waiting for variable to change|
|Posted by:||Anders Eriksson (andis…@gmail.com)|
|Date:||Mon, 17 Nov 2014|
I'm programming in C# and .NET 4.0.30319 SP1Rel in VS2010
I have a dll sequence of functions
The first function (RotateDevice) will set a variable
(startRotation=true) and must wait until the variable reachedPosition is
set to true. Then the next function will be called (MoveDeviceX)
I'm struggling with this! So if someone can help I would appreciate it!
As I said I have an dll, that communicates with some hardware using COM.
A new request has come and I need to add the function RotateDevice
(which rotates the device around the X axis) This is done using two
variables. A double containing an angle and a bool(startRotation) to
start the rotation. The COM method is asynch so it will return directly
and when it has reached the position another bool(reachedPosition) will
be set to true.
Since the device can't move in multiply direction simultaneously I must
wait for the movement to finish (Strangely enough the movement in X and
Z is handled differently so I don't have this problem here)
How would I make the function RotateDevice wait for the reachedPosition
to become true?
Hopefully this is understandable!
English isn't my first language.
So any error or strangeness is due to the translation.
Please correct my English so that I may become better.