fixed a deadlock
This commit is contained in:
24
src/main.c
24
src/main.c
@@ -383,6 +383,7 @@ int main(int argc, char **argv) {
|
|||||||
nn_Component *managedfs = ncl_createFilesystem(u, NULL, mainfspath, &mainfsconf, true);
|
nn_Component *managedfs = ncl_createFilesystem(u, NULL, mainfspath, &mainfsconf, true);
|
||||||
nn_Component *tmpfs = ncl_createTmpFS(u, NULL, &nn_defaultTmpFS, NCL_FILECOST_DEFAULT, false);
|
nn_Component *tmpfs = ncl_createTmpFS(u, NULL, &nn_defaultTmpFS, NCL_FILECOST_DEFAULT, false);
|
||||||
nn_Component *testingfs = ncl_createTmpFS(u, NULL, &nn_defaultFilesystems[3], NCL_FILECOST_DEFAULT, false);
|
nn_Component *testingfs = ncl_createTmpFS(u, NULL, &nn_defaultFilesystems[3], NCL_FILECOST_DEFAULT, false);
|
||||||
|
//nn_Component *testingfs = ncl_createFilesystem(u, NULL, "test", &nn_defaultFilesystems[3], false);
|
||||||
|
|
||||||
const char * const testDriveData =
|
const char * const testDriveData =
|
||||||
"local g, s = component.list('gpu')(), component.list('screen')()\n"
|
"local g, s = component.list('gpu')(), component.list('screen')()\n"
|
||||||
@@ -464,21 +465,6 @@ restart:;
|
|||||||
}
|
}
|
||||||
nn_setCallBudget(c, 0);
|
nn_setCallBudget(c, 0);
|
||||||
|
|
||||||
nn_EncodedNetworkContents contents;
|
|
||||||
nn_pushstring(c, "stuff");
|
|
||||||
nn_pushnull(c);
|
|
||||||
nn_pushnumber(c, 5.3);
|
|
||||||
nn_pushbool(c, false);
|
|
||||||
nn_encodeNetworkContents(c, &contents, 4);
|
|
||||||
nn_popn(c, 4);
|
|
||||||
|
|
||||||
printf("size: %zu\n", contents.buflen);
|
|
||||||
for(size_t i = 0; i < contents.buflen; i++) {
|
|
||||||
unsigned char byte = contents.buf[i];
|
|
||||||
printf("%02X ", byte);
|
|
||||||
}
|
|
||||||
printf("\n");
|
|
||||||
|
|
||||||
// default for 64-bit
|
// default for 64-bit
|
||||||
if(sizeof(void *) > 4) nn_setMemoryScale(c, 1.8);
|
if(sizeof(void *) > 4) nn_setMemoryScale(c, 1.8);
|
||||||
|
|
||||||
@@ -494,7 +480,7 @@ restart:;
|
|||||||
nn_mountComponent(c, eepromCard, 0);
|
nn_mountComponent(c, eepromCard, 0);
|
||||||
nn_mountComponent(c, managedfs, 1);
|
nn_mountComponent(c, managedfs, 1);
|
||||||
nn_mountComponent(c, gpuCard, 2);
|
nn_mountComponent(c, gpuCard, 2);
|
||||||
//nn_mountComponent(c, testingfs, 3);
|
nn_mountComponent(c, testingfs, 3);
|
||||||
nn_mountComponent(c, testDrive, 4);
|
nn_mountComponent(c, testDrive, 4);
|
||||||
nn_mountComponent(c, testFlash, 5);
|
nn_mountComponent(c, testFlash, 5);
|
||||||
while(true) {
|
while(true) {
|
||||||
@@ -578,10 +564,6 @@ restart:;
|
|||||||
if(keycode == KEY_TAB) unicode = '\t';
|
if(keycode == KEY_TAB) unicode = '\t';
|
||||||
}
|
}
|
||||||
|
|
||||||
if(keycode == KEY_F1) {
|
|
||||||
nn_pushModemMessage(c, "bullshit", "someone", 1, 5, &contents);
|
|
||||||
}
|
|
||||||
|
|
||||||
nn_pushKeyDown(c, "mainKB", unicode, keycode_to_oc(keycode), player);
|
nn_pushKeyDown(c, "mainKB", unicode, keycode_to_oc(keycode), player);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -634,7 +616,6 @@ restart:;
|
|||||||
}
|
}
|
||||||
if(state == NN_RESTART) {
|
if(state == NN_RESTART) {
|
||||||
printf("restart requested\n");
|
printf("restart requested\n");
|
||||||
nn_dropNetworkContents(&contents);
|
|
||||||
nn_destroyComputer(c);
|
nn_destroyComputer(c);
|
||||||
goto restart;
|
goto restart;
|
||||||
}
|
}
|
||||||
@@ -653,7 +634,6 @@ cleanup:;
|
|||||||
nn_dropComponent(screen);
|
nn_dropComponent(screen);
|
||||||
nn_dropComponent(gpuCard);
|
nn_dropComponent(gpuCard);
|
||||||
nn_dropComponent(keyboard);
|
nn_dropComponent(keyboard);
|
||||||
nn_dropNetworkContents(&contents);
|
|
||||||
// rip the universe
|
// rip the universe
|
||||||
nn_destroyUniverse(u);
|
nn_destroyUniverse(u);
|
||||||
ncl_destroyGlyphCache(gc);
|
ncl_destroyGlyphCache(gc);
|
||||||
|
|||||||
@@ -1569,16 +1569,7 @@ static nn_Exit ncl_tmpfsHandler(nn_FSRequest *req) {
|
|||||||
}
|
}
|
||||||
if(req->action == NN_FS_MKDIR) {
|
if(req->action == NN_FS_MKDIR) {
|
||||||
nn_lock(ctx, tmpfs->lock);
|
nn_lock(ctx, tmpfs->lock);
|
||||||
if(ncl_tmpSpaceFree(tmpfs) < tmpfs->fileCost) {
|
ncl_tmpMkdir(tmpfs->root, req->mkdir);
|
||||||
nn_unlock(ctx, tmpfs->lock);
|
|
||||||
nn_setError(C, "out of space");
|
|
||||||
return NN_EBADCALL;
|
|
||||||
}
|
|
||||||
if(!ncl_tmpMkdir(tmpfs->root, req->mkdir)) {
|
|
||||||
nn_unlock(ctx, tmpfs->lock);
|
|
||||||
nn_setError(C, "operation failed");
|
|
||||||
return NN_EBADCALL;
|
|
||||||
}
|
|
||||||
nn_unlock(ctx, tmpfs->lock);
|
nn_unlock(ctx, tmpfs->lock);
|
||||||
return NN_OK;
|
return NN_OK;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user