Skip to content

Commit 269a6e9

Browse files
committed
Asyncify: remove stub functions, require -s ASYNCIFY if linking to library_async.js
1 parent 57cf42f commit 269a6e9

File tree

2 files changed

+9
-50
lines changed

2 files changed

+9
-50
lines changed

src/library_async.js

Lines changed: 5 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,10 @@
88
// Async support via ASYNCIFY
99
//
1010

11+
if (!ASYNCIFY) {
12+
throw "To link with the async library you must use -s ASYNCIFY";
13+
}
14+
1115
mergeInto(LibraryManager.library, {
1216
// error handling
1317

@@ -19,7 +23,6 @@ mergeInto(LibraryManager.library, {
1923
}
2024
},
2125

22-
#if ASYNCIFY
2326
$Asyncify__deps: ['$Browser', '$runAndAbortIfError'],
2427
$Asyncify: {
2528
State: {
@@ -489,50 +492,6 @@ mergeInto(LibraryManager.library, {
489492
Asyncify.currData = null;
490493
}
491494
},
492-
493-
emscripten_coroutine_create: function() {
494-
throw 'emscripten_coroutine_create has been removed. Please use the Fibers API';
495-
},
496-
emscripten_coroutine_next: function() {
497-
throw 'emscripten_coroutine_next has been removed. Please use the Fibers API';
498-
},
499-
emscripten_yield: function() {
500-
throw 'emscripten_yield has been removed. Please use the Fibers API';
501-
},
502-
#else // ASYNCIFY
503-
emscripten_sleep: function() {
504-
throw 'Please compile your program with async support in order to use asynchronous operations like emscripten_sleep';
505-
},
506-
emscripten_coroutine_create: function() {
507-
throw 'Please compile your program with async support in order to use asynchronous operations like emscripten_coroutine_create';
508-
},
509-
emscripten_coroutine_next: function() {
510-
throw 'Please compile your program with async support in order to use asynchronous operations like emscripten_coroutine_next';
511-
},
512-
emscripten_yield: function() {
513-
throw 'Please compile your program with async support in order to use asynchronous operations like emscripten_yield';
514-
},
515-
emscripten_wget: function() {
516-
throw 'Please compile your program with async support in order to use asynchronous operations like emscripten_wget';
517-
},
518-
emscripten_wget_data: function() {
519-
throw 'Please compile your program with async support in order to use asynchronous operations like emscripten_wget_data';
520-
},
521-
emscripten_scan_registers: function() {
522-
throw 'Please compile your program with async support in order to use asynchronous operations like emscripten_scan_registers';
523-
},
524-
emscripten_fiber_init: function() {
525-
throw 'Please compile your program with async support in order to use asynchronous operations like emscripten_fiber_init';
526-
},
527-
emscripten_fiber_init_from_current_context: function() {
528-
throw 'Please compile your program with async support in order to use asynchronous operations like emscripten_fiber_init_from_current_context';
529-
},
530-
emscripten_fiber_swap: function() {
531-
throw 'Please compile your program with async support in order to use asynchronous operations like emscripten_fiber_swap';
532-
},
533-
#endif // ASYNCIFY
534495
});
535496

536-
if (ASYNCIFY) {
537-
DEFAULT_LIBRARY_FUNCS_TO_INCLUDE.push('$Asyncify');
538-
}
497+
DEFAULT_LIBRARY_FUNCS_TO_INCLUDE.push('$Asyncify');

src/modules.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -130,12 +130,8 @@ var LibraryManager = {
130130
'library_uuid.js',
131131
'library_glew.js',
132132
'library_idbstore.js',
133-
'library_async.js'
134133
]);
135134
} else {
136-
if (ASYNCIFY) {
137-
libraries.push('library_async.js');
138-
}
139135
if (USE_SDL == 1) {
140136
libraries.push('library_sdl.js');
141137
}
@@ -144,6 +140,10 @@ var LibraryManager = {
144140
}
145141
}
146142

143+
if (ASYNCIFY) {
144+
libraries.push('library_async.js');
145+
}
146+
147147
// Add any explicitly specified system JS libraries to link to, add those to link.
148148
libraries = libraries.concat(SYSTEM_JS_LIBRARIES)
149149

0 commit comments

Comments
 (0)