| 852 | } |
| 853 | |
| 854 | void fx_setTimer(txMachine* the, txNumber interval, txBoolean repeat) |
| 855 | { |
| 856 | txJob _job; |
| 857 | txJob* job; |
| 858 | txSharedTimer* timer; |
| 859 | if (c_isnan(interval) || (interval < 0)) |
| 860 | interval = 0; |
| 861 | c_memset(&_job, 0, sizeof(txJob)); |
| 862 | timer = fxScheduleSharedTimer(interval, (repeat) ? interval : 0, fx_callbackTimer, &_job, sizeof(txJob)); |
| 863 | if (!timer) |
| 864 | fxAbort(the, XS_NOT_ENOUGH_MEMORY_EXIT); |
| 865 | job = (txJob*)&(timer->refcon[0]); |
| 866 | job->the = the; |
| 867 | fxNewHostObject(the, NULL); |
| 868 | mxPull(job->self); |
| 869 | job->function = *mxArgv(0); |
| 870 | if (mxArgc > 2) |
| 871 | job->argument = *mxArgv(2); |
| 872 | else |
| 873 | job->argument = mxUndefined; |
| 874 | fxSetHostData(the, &job->self, job); |
| 875 | fxSetHostHooks(the, &job->self, &gxTimerHooks); |
| 876 | fxRemember(the, &job->self); |
| 877 | fxAccess(the, &job->self); |
| 878 | *mxResult = the->scratch; |
| 879 | } |
| 880 | |
| 881 | /* PLATFORM */ |
| 882 |
no test coverage detected