diff --git a/pthreadfs/README.md b/pthreadfs/README.md index 21df288ad10db..92b79c3367f6d 100644 --- a/pthreadfs/README.md +++ b/pthreadfs/README.md @@ -73,7 +73,7 @@ See `pthreadfs/examples/emscripten-tests/fsafs.cpp` for exemplary usage. - Some functionality of the Emscripten File System API is missing, such as sockets, IndexedDB integration and support for XHRequests. - PThreadFS depends on C++ libraries. `EM_PTHREADFS_ASM()` cannot be used within C files. - Performance is good if and only if optimizations (compiler option `-O2`) are enabled and DevTools are closed. -- Accessing the file system before `main()` is called may not work. +- Accessing the file system before `main()` requires linker option `PTHREAD_POOL_SIZE=` to be active. Doing so may lead to some blocking of the main thread, which is risky. Check out `examples/early_syscall.cpp` for an example. - The Storage Foundation backend requires case-insensitive file names. - Compiling with the Closure Compiler is not supported. - Compiling with optimization `-O3` is not yet supported and may lead to a faulty build. diff --git a/pthreadfs/examples/emscripten-tests/FAIL_early_stat64.cpp b/pthreadfs/examples/emscripten-tests/early_syscall.cpp similarity index 87% rename from pthreadfs/examples/emscripten-tests/FAIL_early_stat64.cpp rename to pthreadfs/examples/emscripten-tests/early_syscall.cpp index dbd72fab3d46f..f68b0a136b05f 100644 --- a/pthreadfs/examples/emscripten-tests/FAIL_early_stat64.cpp +++ b/pthreadfs/examples/emscripten-tests/early_syscall.cpp @@ -19,7 +19,7 @@ int main() { class EarlyObject { public: EarlyObject() { - puts("This test is a warning: Do not use syscalls in objects before main is called!"); + puts("This test will fail unless compiled with PTHREAD_POOL_SIZE=2 (or higher)."); puts("Start constructing EarlyObject."); int err; struct stat s; diff --git a/pthreadfs/pthreadfs.cpp b/pthreadfs/pthreadfs.cpp index 872f97c77ff40..cc98141024eb7 100644 --- a/pthreadfs/pthreadfs.cpp +++ b/pthreadfs/pthreadfs.cpp @@ -311,7 +311,7 @@ SYS_CAPI_DEF( // Define global variables to be populated by resume; std::function g_resumeFct; -emscripten::sync_to_async g_sync_to_async_helper; +emscripten::sync_to_async g_sync_to_async_helper __attribute__((init_priority(102))); // Other helper code