-
Notifications
You must be signed in to change notification settings - Fork 148
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add Timeout CBA_fnc_waitUntilAndExecute #560
Conversation
@@ -80,6 +80,22 @@ GVAR(waitUntilAndExecArray) = []; | |||
if (_delete) then { | |||
GVAR(waitUntilAndExecArray) = GVAR(waitUntilAndExecArray) - [objNull]; | |||
}; | |||
|
|||
// Execute the waitUntilAndExecTimeout functions: | |||
_delete = false; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
could move this line after L81, so the flag is only reset if it ever where changed to true
. I think the same can be done above that once too. Minor performance improvement.
|
||
GVAR(waitUntilAndExecArray) pushBack [_condition, _statement, _args]; | ||
if (_timeout == 1E9) then { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
maybe use isNil "_timeout"
and have no default value / default value nil
in params
?
No one will ever use 1E9
, but having a random high number seems weird. (Especially an integer above single point floating precision.)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How about default timeout value of -1,
and only use time if _timeout >= 0
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could make default 0 and go for _timeout > 0
, since 0 whould mean there is an immediate timeout.
if (_timeout == 1E9) then { | ||
GVAR(waitUntilAndExecArray) pushBack [_condition, _statement, _args]; | ||
} else { | ||
GVAR(waitUntilAndExecTimeoutArray) pushBack [_condition, _statement, _args, _timeout, _timeoutCode, time]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we want CBA_missionTime
instead of time
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I used time because it's to measure relative time on one machine, but I can change it.
Using this wrapper, we can use the existing
|
The timeout condition is |
lgtm |
When merged this pull request will:
_timeout
and_timeoutCode
params, put calls that use them in a newGVAR(waitUntilAndExecTimeoutArray)
array to not add any overhead to the usualGVAR(waitUntilAndExecArray)
.Separating the calls with timeout and without timeout into different arrays seemed like a better option then to add an overhead to everything that currently uses CBA's main PFH.