Skip to content

Commit

Permalink
Merge pull request emscripten-core#16 from rstz/fix-early-syscalls
Browse files Browse the repository at this point in the history
Fix early syscall use by adding a Clang attribute.
  • Loading branch information
rstz authored Oct 5, 2021
2 parents 1202327 + 8396aef commit dfc385c
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion pthreadfs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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=<expression>` 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.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion pthreadfs/pthreadfs.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -311,7 +311,7 @@ SYS_CAPI_DEF(

// Define global variables to be populated by resume;
std::function<void()> 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

Expand Down

0 comments on commit dfc385c

Please sign in to comment.