Function Calling

simosimo Junior MemberPosts: 6

A function is called that takes approx 500msec to process

If the function is called again 250ms later.

Does the fuction Break and start again?

Comments

  • fogled@mizzou[email protected] h4x354x0r Posts: 547

    In my experience, the 2nd call to the function just waits, but does eventually get processed. I think AMX controllers are still a single-threaded runtime environment. If you repeatedly call the same function faster than the function can process, you'll eventually break something somewhere, I just don't know where that point of failure is. Other more experienced programmers may be able to provide more detail on these kinds of limits.

  • viningvining X Member Posts: 4,348

    Is there a wait in the function and that’s why it takes 500ms? If that’s the case the function can be called again and run but the pending wait will not be put into another wait or reset unless you cancel that named wait then the wait can be set again. So the wait will trigger after the first call of the function wait time times out which may or may not have the desired affect depending on what’s change during subsequent calls of the function.

    Maybe showing the code and explaining its desired purpose would help folks better answer your question.

  • ericmedleyericmedley Senior Member - 3709 Posts Posts: 4,152

    I do not put waits in function calls. I have found that their behavior is not predictable. I usually just send things that need to be timed to a timeline. The function is really just preparation to run the timeline. Plus with a timeline and queue you can have many multiple calls that never run into each other.

Sign In or Register to comment.