Fix more async leakage.
This commit is contained in:
parent
7b014ebafa
commit
40506fd6b2
|
@ -445,8 +445,12 @@ int runTests(int detailed, int specificTest)
|
||||||
struct helpText h = helpTexts[hi];
|
struct helpText h = helpTexts[hi];
|
||||||
if (h.tests) {
|
if (h.tests) {
|
||||||
if (detailed && h.testCount > 0) {
|
if (detailed && h.testCount > 0) {
|
||||||
|
if (isSpecific) {
|
||||||
|
printf("[0m`%s` ", h.symbol);
|
||||||
|
} else {
|
||||||
printf("[0m `%s` ", h.symbol);
|
printf("[0m `%s` ", h.symbol);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
for (int ti = 0; ti < h.testCount; ti += 2) {
|
for (int ti = 0; ti < h.testCount; ti += 2) {
|
||||||
const char* test = h.tests[ti];
|
const char* test = h.tests[ti];
|
||||||
const char* expected = h.tests[ti + 1];
|
const char* expected = h.tests[ti + 1];
|
||||||
|
|
|
@ -61,6 +61,7 @@ void* doAsync(void* args)
|
||||||
promise->done = 1;
|
promise->done = 1;
|
||||||
cleanPromise(promise);
|
cleanPromise(promise);
|
||||||
|
|
||||||
|
deleteEnv(promise->env);
|
||||||
cleanObject(&cloned);
|
cleanObject(&cloned);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
@ -75,6 +76,7 @@ Object async(Object* params, int length, struct Environment* env)
|
||||||
.env = env,
|
.env = env,
|
||||||
.object = cloneObject(params[0]),
|
.object = cloneObject(params[0]),
|
||||||
};
|
};
|
||||||
|
env->refs += 1;
|
||||||
|
|
||||||
pthread_create(&promise.promise->thread, NULL, doAsync, promise.promise);
|
pthread_create(&promise.promise->thread, NULL, doAsync, promise.promise);
|
||||||
return promise;
|
return promise;
|
||||||
|
|
Loading…
Reference in New Issue