MCPcopy Create free account
hub / github.com/buke/quickjs-go / isExecuteTimeoutExceeded

Function isExecuteTimeoutExceeded

bridge.c:895–918  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

893static qjsgo_mutex_t g_timeout_states_mu = QJSGO_MUTEX_INITIALIZER;
894
895static int isExecuteTimeoutExceeded(JSRuntime *rt) {
896 time_t start = 0;
897 time_t timeout = 0;
898 int found = 0;
899
900 qjsgo_mutex_lock(&g_timeout_states_mu);
901 TimeoutStateEntry *current = g_timeout_states;
902 while (current) {
903 if (current->rt == rt && current->state != NULL) {
904 start = current->state->start;
905 timeout = current->state->timeout;
906 found = 1;
907 break;
908 }
909 current = current->next;
910 }
911 qjsgo_mutex_unlock(&g_timeout_states_mu);
912
913 if (!found || timeout <= 0) {
914 return 0;
915 }
916
917 return (time(NULL) - start) > timeout;
918}
919static TimeoutStruct *takeTimeoutState(JSRuntime *rt) {
920 qjsgo_mutex_lock(&g_timeout_states_mu);
921

Callers 1

AwaitValueFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected