|
91 | 91 | #define fxUnlockMutex(MUTEX) LeaveCriticalSection(MUTEX) |
92 | 92 | #define fxSleepCondition(CONDITION,MUTEX) SleepConditionVariableCS(CONDITION,MUTEX,INFINITE) |
93 | 93 | #define fxWakeCondition(CONDITION) WakeConditionVariable(CONDITION) |
| 94 | +#elif _ZEPHYR |
| 95 | + |
| 96 | + typedef uint32_t txCondition; |
| 97 | + typedef void *txMutex; |
| 98 | + typedef void *txThread; |
| 99 | + #define fxCreateCondition(CONDITION) |
| 100 | + #define fxSleepCondition(CONDITION,MUTEX) |
| 101 | + #define fxWakeCondition(CONDITION) |
| 102 | + |
| 103 | + #define fxCreateMutex(MUTEX) |
| 104 | + #define fxDeleteMutex(MUTEX) |
| 105 | + #define fxLockMutex(MUTEX) |
| 106 | + #define fxUnlockMutex(MUTEX) |
94 | 107 | #else |
95 | 108 | #include <dirent.h> |
96 | 109 | #include <pthread.h> |
@@ -381,7 +394,7 @@ void _262_agent_broadcast(txMachine* the) |
381 | 394 | gxAgentCluster.dataValue = xsToInteger(xsArg(1)); |
382 | 395 | #if mxWindows |
383 | 396 | WakeAllConditionVariable(&(gxAgentCluster.dataCondition)); |
384 | | -#elif PICO_BUILD |
| 397 | +#elif PICO_BUILD || _ZEPHYR |
385 | 398 | #else |
386 | 399 | pthread_cond_broadcast(&(gxAgentCluster.dataCondition)); |
387 | 400 | #endif |
@@ -468,7 +481,7 @@ void _262_agent_sleep(txMachine* the) |
468 | 481 | xsIntegerValue delay = xsToInteger(xsArg(0)); |
469 | 482 | #ifdef mxUseFreeRTOSTasks |
470 | 483 | vTaskDelay(pdMS_TO_TICKS(delay)); |
471 | | -#elif PICO_BUILD |
| 484 | +#elif PICO_BUILD || _ZEPHYR |
472 | 485 | modDelayMilliseconds(delay); |
473 | 486 | #elif mxWindows |
474 | 487 | Sleep(delay); |
@@ -501,7 +514,7 @@ void _262_agent_start(txMachine* the) |
501 | 514 | xTaskCreate(_262_agent_start_aux, "agent", kStack, agent, 8, &(agent->thread)); |
502 | 515 | #elif mxWindows |
503 | 516 | agent->thread = (HANDLE)_beginthreadex(NULL, 0, _262_agent_start_aux, agent, 0, NULL); |
504 | | -#elif PICO_BUILD |
| 517 | +#elif PICO_BUILD || _ZEPHYR |
505 | 518 | _262_agent_start_aux(agent); |
506 | 519 | #else |
507 | 520 | pthread_create(&(agent->thread), NULL, &_262_agent_start_aux, agent); |
@@ -588,7 +601,7 @@ void _262_agent_stop(txMachine* the) |
588 | 601 | #if mxWindows |
589 | 602 | WaitForSingleObject(agent->thread, INFINITE); |
590 | 603 | CloseHandle(agent->thread); |
591 | | - #elif PICO_BUILD |
| 604 | + #elif PICO_BUILD || _ZEPHYR |
592 | 605 | #else |
593 | 606 | pthread_join(agent->thread, NULL); |
594 | 607 | #endif |
|
0 commit comments