Hi Stirling,
Thanks for your input, but there was definitely an increase in processor usage without the sleep commands.
Processor usage w/o sleep commands is at a constant 62%.... after adding the sleep commands processor usage is below 5%.
Thanks,
JJ
Hi JJ - Sorry - I havn't made my point very well. Obviously with a call to sleep you're going to see CPU usage falling but my point is - is that useful? and what are the downsides overall?
Let me try it another way. IF the CPU was whiting out then the possibility would exist that the Mach thread was being starved of CPU. In this case it may be useful to reduce the CPU being used by the VB thread. But from what you've said - this isn't the case - you're only at 62%. So the downside of slowing down the VB thread's reaction to the semaphore is somewhat pointless IMHO. By way of example:
code "G1 X100 Y100"
while isMoving()
sleep(100)
wend
code "G1 X0 Y0"
On average there is going to be a delay of 50ms between the first move finishing and the second move starting - for what? Without the delay you have a CPU that's spending 38% of its time idle anyway. I don't know what the loop cycle is without any explicit delay but clearly its going to be shorter without it - 100ms shorter.
As I say - just my opinion but to my no doubt crazy brain - it seems to make sense to me
