| 339 | } |
| 340 | |
| 341 | bool Squirrel::Resume(int suspend) |
| 342 | { |
| 343 | assert(!this->crashed); |
| 344 | ScriptAllocatorScope alloc_scope(this); |
| 345 | |
| 346 | /* Did we use more operations than we should have in the |
| 347 | * previous tick? If so, subtract that from the current run. */ |
| 348 | if (this->overdrawn_ops > 0 && suspend > 0) { |
| 349 | this->overdrawn_ops -= suspend; |
| 350 | /* Do we need to wait even more? */ |
| 351 | if (this->overdrawn_ops >= 0) return true; |
| 352 | |
| 353 | /* We can now only run whatever is "left". */ |
| 354 | suspend = -this->overdrawn_ops; |
| 355 | } |
| 356 | |
| 357 | this->crashed = !sq_resumecatch(this->vm, suspend); |
| 358 | this->overdrawn_ops = -this->vm->_ops_till_suspend; |
| 359 | this->allocator->CheckLimit(); |
| 360 | return this->vm->_suspended != 0; |
| 361 | } |
| 362 | |
| 363 | void Squirrel::ResumeError() |
| 364 | { |
no test coverage detected