| 631 | sl_semaphore *sleepssemaphore = new sl_semaphore(1, NULL); // guard the sleeps-vector with a semaphore, so we can add sleeps from other threads |
| 632 | |
| 633 | void addsleep(int msec, const char *cmd, bool persist) |
| 634 | { |
| 635 | sleepssemaphore->wait(); |
| 636 | scriptsleep &s = sleeps.add(); |
| 637 | s.wait = max(msec, 1); |
| 638 | s.millis = lastmillis; |
| 639 | s.cmd = newstring(cmd); |
| 640 | s.persist = persist; |
| 641 | sleepssemaphore->post(); |
| 642 | } |
| 643 | |
| 644 | void addsleep_(int *msec, char *cmd, int *persist) |
| 645 | { |