MCPcopy Create free account
hub / github.com/Moddable-OpenSource/moddable / _262_agent_start

Function _262_agent_start

tools/test262/_262.c:493–522  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

491}
492
493void _262_agent_start(txMachine* the)
494{
495 xsStringValue script = xsToString(xsArg(0));
496 xsIntegerValue scriptLength = c_strlen(script);
497 txAgent* agent = c_malloc(sizeof(txAgent) + scriptLength);
498 if (!agent) xsUnknownError("not enough memory");
499 c_memset(agent, 0, sizeof(txAgent));
500 if (gxAgentCluster.firstAgent)
501 gxAgentCluster.lastAgent->next = agent;
502 else
503 gxAgentCluster.firstAgent = agent;
504 gxAgentCluster.lastAgent = agent;
505 gxAgentCluster.count++;
506 agent->scriptLength = scriptLength;
507 c_memcpy(&(agent->script[0]), script, scriptLength + 1);
508#ifdef mxUseFreeRTOSTasks
509 #if 0 == CONFIG_LOG_DEFAULT_LEVEL
510 #define kStack ((8 * 1024) / sizeof(StackType_t))
511 #else
512 #define kStack ((9 * 1024) / sizeof(StackType_t))
513 #endif
514 xTaskCreate(_262_agent_start_aux, "agent", kStack, agent, 8, &(agent->thread));
515#elif mxWindows
516 agent->thread = (HANDLE)_beginthreadex(NULL, 0, _262_agent_start_aux, agent, 0, NULL);
517#elif PICO_BUILD || __ZEPHYR__
518 _262_agent_start_aux(agent);
519#else
520 pthread_create(&(agent->thread), NULL, &_262_agent_start_aux, agent);
521#endif
522}
523
524#ifdef mxUseFreeRTOSTasks
525void _262_agent_start_aux(void *it)

Callers

nothing calls this directly

Calls 1

_262_agent_start_auxFunction · 0.85

Tested by

no test coverage detected