mirror of https://gitlab.com/nakst/essence
don't use external coroutines on mac
This commit is contained in:
parent
7c930455b4
commit
3c28c5d0f5
|
@ -4593,11 +4593,15 @@ int ExternalCharacterToByte(ExecutionContext *context, Value *returnValue) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void ExternalCoroutineDone(CoroutineState *coroutine) {
|
void ExternalCoroutineDone(CoroutineState *coroutine) {
|
||||||
|
#ifdef __linux__
|
||||||
sem_post(&externalCoroutineSemaphore);
|
sem_post(&externalCoroutineSemaphore);
|
||||||
pthread_mutex_lock(&externalCoroutineMutex);
|
pthread_mutex_lock(&externalCoroutineMutex);
|
||||||
coroutine->nextUnblockedCoroutine = externalCoroutineUnblockedList;
|
coroutine->nextUnblockedCoroutine = externalCoroutineUnblockedList;
|
||||||
externalCoroutineUnblockedList = coroutine;
|
externalCoroutineUnblockedList = coroutine;
|
||||||
pthread_mutex_unlock(&externalCoroutineMutex);
|
pthread_mutex_unlock(&externalCoroutineMutex);
|
||||||
|
#else
|
||||||
|
(void) coroutine;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void *SystemShellExecuteThread(void *_coroutine) {
|
void *SystemShellExecuteThread(void *_coroutine) {
|
||||||
|
@ -4629,9 +4633,15 @@ int ExternalSystemShellExecute(ExecutionContext *context, Value *returnValue) {
|
||||||
temporary[bytes] = 0;
|
temporary[bytes] = 0;
|
||||||
if (systemShellLoggingEnabled) PrintDebug("\033[0;32m%s\033[0m\n", temporary);
|
if (systemShellLoggingEnabled) PrintDebug("\033[0;32m%s\033[0m\n", temporary);
|
||||||
context->c->externalCoroutineData2 = temporary;
|
context->c->externalCoroutineData2 = temporary;
|
||||||
|
#ifdef __linux__
|
||||||
pthread_t thread;
|
pthread_t thread;
|
||||||
pthread_create(&thread, NULL, SystemShellExecuteThread, context->c);
|
pthread_create(&thread, NULL, SystemShellExecuteThread, context->c);
|
||||||
return 4;
|
return 4;
|
||||||
|
#else
|
||||||
|
SystemShellExecuteThread(context->c);
|
||||||
|
*returnValue = context->c->externalCoroutineData;
|
||||||
|
return 2;
|
||||||
|
#endif
|
||||||
} else {
|
} else {
|
||||||
fprintf(stderr, "Error in ExternalSystemShellExecute: Out of memory.\n");
|
fprintf(stderr, "Error in ExternalSystemShellExecute: Out of memory.\n");
|
||||||
returnValue->i = 0;
|
returnValue->i = 0;
|
||||||
|
@ -4691,10 +4701,16 @@ int ExternalSystemShellExecuteWithWorkingDirectory(ExecutionContext *context, Va
|
||||||
free(temporary2);
|
free(temporary2);
|
||||||
|
|
||||||
if (pid > 0) {
|
if (pid > 0) {
|
||||||
|
#ifdef __linux__
|
||||||
context->c->externalCoroutineData.i = pid;
|
context->c->externalCoroutineData.i = pid;
|
||||||
pthread_t thread;
|
pthread_t thread;
|
||||||
pthread_create(&thread, NULL, SystemShellExecuteWithWorkingDirectoryThread, context->c);
|
pthread_create(&thread, NULL, SystemShellExecuteWithWorkingDirectoryThread, context->c);
|
||||||
return 4;
|
return 4;
|
||||||
|
#else
|
||||||
|
SystemShellExecuteWithWorkingDirectoryThread(context->c);
|
||||||
|
*returnValue = context->c->externalCoroutineData;
|
||||||
|
return 2;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
return 2;
|
return 2;
|
||||||
|
|
|
@ -4,7 +4,7 @@ str options #option;
|
||||||
str target #option;
|
str target #option;
|
||||||
|
|
||||||
void Start() {
|
void Start() {
|
||||||
// SystemShellEnableLogging(false);
|
SystemShellEnableLogging(false);
|
||||||
|
|
||||||
assert PathCreateLeadingDirectories("bin/dependency_files");
|
assert PathCreateLeadingDirectories("bin/dependency_files");
|
||||||
assert PathCreateLeadingDirectories("bin/Logs");
|
assert PathCreateLeadingDirectories("bin/Logs");
|
||||||
|
|
Loading…
Reference in New Issue