Get rid of fiber for finalizers.

Instead, finalizers just get access to the foreign object's raw bytes.
This is deliberately limiting, since it discourages the user from
interacting with the VM in the middle of a GC.
This commit is contained in:
Bob Nystrom
2015-12-28 08:06:29 -08:00
parent a447b66380
commit ed6fad6153
7 changed files with 31 additions and 37 deletions
+2 -2
View File
@@ -144,9 +144,9 @@ void fileAllocate(WrenVM* vm)
*fd = (int)wrenGetSlotDouble(vm, 1);
}
void fileFinalize(WrenVM* vm)
void fileFinalize(void* data)
{
int fd = *(int*)wrenGetSlotForeign(vm, 0);
int fd = *(int*)data;
// Already closed.
if (fd == -1) return;