MCPcopy Create free account
hub / github.com/emscripten-core/emscripten / close

Method close

system/lib/wasmfs/backends/opfs_backend.cpp:100–120  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

98 }
99
100 int close(Worker& proxy) {
101 // TODO: Downgrade to Blob access once the last writable file descriptor has
102 // been closed.
103 int err = 0;
104 if (--openCount == 0) {
105 switch (kind) {
106 case Access:
107 proxy(
108 [&](auto ctx) { _wasmfs_opfs_close_access(ctx.ctx, id, &err); });
109 break;
110 case Blob:
111 proxy([&]() { _wasmfs_opfs_close_blob(id); });
112 break;
113 case None:
114 WASMFS_UNREACHABLE("Open file should have kind");
115 }
116 kind = None;
117 id = -1;
118 }
119 return err;
120 }
121
122 int getAccessID() {
123 assert(openCount > 0);

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected