webruby 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/bin/webruby +36 -0
- data/driver/driver.c +50 -0
- data/driver/main.c +40 -0
- data/lib/webruby/app.rb +13 -0
- data/lib/webruby/config.rb +61 -0
- data/lib/webruby/environment.rb +32 -0
- data/lib/webruby/rake/files.rake +66 -0
- data/lib/webruby/rake/general.rake +22 -0
- data/lib/webruby/rake/mruby.rake +44 -0
- data/lib/webruby/utility.rb +132 -0
- data/lib/webruby.rb +10 -0
- data/modules/emscripten/AUTHORS +89 -0
- data/modules/emscripten/LICENSE +68 -0
- data/modules/emscripten/README.markdown +14 -0
- data/modules/emscripten/cmake/Platform/Emscripten.cmake +61 -0
- data/modules/emscripten/cmake/Platform/Emscripten_unix.cmake +24 -0
- data/modules/emscripten/em++ +12 -0
- data/modules/emscripten/em++.bat +2 -0
- data/modules/emscripten/em-config +24 -0
- data/modules/emscripten/em-config.bat +2 -0
- data/modules/emscripten/emar +24 -0
- data/modules/emscripten/emar.bat +2 -0
- data/modules/emscripten/emcc +1744 -0
- data/modules/emscripten/emcc.bat +2 -0
- data/modules/emscripten/emcc.py +5 -0
- data/modules/emscripten/emconfigure +27 -0
- data/modules/emscripten/emconfigure.bat +2 -0
- data/modules/emscripten/emlibtool +11 -0
- data/modules/emscripten/emlibtool.bat +2 -0
- data/modules/emscripten/emlink.py +293 -0
- data/modules/emscripten/emmake +29 -0
- data/modules/emscripten/emmake.bat +2 -0
- data/modules/emscripten/emranlib +9 -0
- data/modules/emscripten/emranlib.bat +2 -0
- data/modules/emscripten/emscons +20 -0
- data/modules/emscripten/emscripten.py +835 -0
- data/modules/emscripten/patches/README +4 -0
- data/modules/emscripten/patches/series +2 -0
- data/modules/emscripten/scons-tools/closure.py +28 -0
- data/modules/emscripten/scons-tools/emscripten.py +359 -0
- data/modules/emscripten/scons-tools/llvm.py +33 -0
- data/modules/emscripten/src/analyzer.js +1695 -0
- data/modules/emscripten/src/compiler.html +48 -0
- data/modules/emscripten/src/compiler.js +298 -0
- data/modules/emscripten/src/corruptionCheck.js +98 -0
- data/modules/emscripten/src/determinstic.js +20 -0
- data/modules/emscripten/src/embind/embind.js +1677 -0
- data/modules/emscripten/src/embind/emval.js +283 -0
- data/modules/emscripten/src/experimental/allow_loopvars_from_memsetcpy_inasm.diff +97 -0
- data/modules/emscripten/src/experimental/batching.diff +44 -0
- data/modules/emscripten/src/experimental/functypeopt.diff +113 -0
- data/modules/emscripten/src/experimental/multiple_heaps.diff +175 -0
- data/modules/emscripten/src/experimental/noncallgraphprofiling.diff +197 -0
- data/modules/emscripten/src/experimental/optimize_memcpy_for_ta1.diff +124 -0
- data/modules/emscripten/src/experimental/remove__label__s.diff +140 -0
- data/modules/emscripten/src/experimental/renderer_cache_hash.diff +99 -0
- data/modules/emscripten/src/experimental/sdl_key_forwarding.diff +57 -0
- data/modules/emscripten/src/experimental/simplifyGeneratedFunctionsDetection.diff +336 -0
- data/modules/emscripten/src/experimental/stringCache.diff +147 -0
- data/modules/emscripten/src/fastLong.js +299 -0
- data/modules/emscripten/src/framework.js +257 -0
- data/modules/emscripten/src/gl-matrix.js +1952 -0
- data/modules/emscripten/src/headless.js +904 -0
- data/modules/emscripten/src/intertyper.js +1050 -0
- data/modules/emscripten/src/jsifier.js +1827 -0
- data/modules/emscripten/src/library.js +8270 -0
- data/modules/emscripten/src/library_browser.js +911 -0
- data/modules/emscripten/src/library_egl.js +491 -0
- data/modules/emscripten/src/library_gc.js +236 -0
- data/modules/emscripten/src/library_gl.js +4452 -0
- data/modules/emscripten/src/library_glfw.js +576 -0
- data/modules/emscripten/src/library_glut.js +449 -0
- data/modules/emscripten/src/library_jansson.js +320 -0
- data/modules/emscripten/src/library_openal.js +602 -0
- data/modules/emscripten/src/library_sdl.js +2024 -0
- data/modules/emscripten/src/library_strtok_r.c +97 -0
- data/modules/emscripten/src/library_xlib.js +23 -0
- data/modules/emscripten/src/long.js +1609 -0
- data/modules/emscripten/src/modules.js +491 -0
- data/modules/emscripten/src/parseTools.js +2474 -0
- data/modules/emscripten/src/postamble.js +170 -0
- data/modules/emscripten/src/postamble_sharedlib.js +16 -0
- data/modules/emscripten/src/preamble.js +914 -0
- data/modules/emscripten/src/preamble_sharedlib.js +25 -0
- data/modules/emscripten/src/relooper/README.markdown +14 -0
- data/modules/emscripten/src/relooper/Relooper.cpp +1236 -0
- data/modules/emscripten/src/relooper/Relooper.h +250 -0
- data/modules/emscripten/src/relooper/doit.sh +70 -0
- data/modules/emscripten/src/relooper/emscripten/glue.js +57 -0
- data/modules/emscripten/src/relooper/emscripten/test.js +44 -0
- data/modules/emscripten/src/relooper/fuzzer.py +116 -0
- data/modules/emscripten/src/relooper/ministring.h +35 -0
- data/modules/emscripten/src/relooper/paper.pdf +0 -0
- data/modules/emscripten/src/relooper/test.cpp +262 -0
- data/modules/emscripten/src/relooper/test.txt +155 -0
- data/modules/emscripten/src/relooper/test2.c +44 -0
- data/modules/emscripten/src/relooper/test2.txt +12 -0
- data/modules/emscripten/src/relooper/test3.c +42 -0
- data/modules/emscripten/src/relooper/test3.txt +27 -0
- data/modules/emscripten/src/relooper/test4.cpp +40 -0
- data/modules/emscripten/src/relooper/test4.txt +23 -0
- data/modules/emscripten/src/relooper/test5.cpp +40 -0
- data/modules/emscripten/src/relooper/test5.txt +32 -0
- data/modules/emscripten/src/relooper/test6.cpp +31 -0
- data/modules/emscripten/src/relooper/test6.txt +12 -0
- data/modules/emscripten/src/relooper/test_dead.cpp +28 -0
- data/modules/emscripten/src/relooper/test_dead.txt +9 -0
- data/modules/emscripten/src/relooper/test_debug.cpp +30 -0
- data/modules/emscripten/src/relooper/test_debug.txt +128 -0
- data/modules/emscripten/src/relooper/test_fuzz1.cpp +52 -0
- data/modules/emscripten/src/relooper/test_fuzz1.txt +32 -0
- data/modules/emscripten/src/relooper/test_fuzz2.cpp +34 -0
- data/modules/emscripten/src/relooper/test_fuzz2.txt +13 -0
- data/modules/emscripten/src/relooper/test_fuzz3.cpp +36 -0
- data/modules/emscripten/src/relooper/test_fuzz3.txt +9 -0
- data/modules/emscripten/src/relooper/test_fuzz4.cpp +38 -0
- data/modules/emscripten/src/relooper/test_fuzz4.txt +19 -0
- data/modules/emscripten/src/relooper/test_fuzz5.cpp +57 -0
- data/modules/emscripten/src/relooper/test_fuzz5.txt +52 -0
- data/modules/emscripten/src/relooper/test_fuzz6.cpp +322 -0
- data/modules/emscripten/src/relooper/test_fuzz6.txt +108 -0
- data/modules/emscripten/src/relooper/test_inf.cpp +813 -0
- data/modules/emscripten/src/relooper/test_inf.txt +385 -0
- data/modules/emscripten/src/relooper/testit.sh +62 -0
- data/modules/emscripten/src/relooper/updateit.sh +17 -0
- data/modules/emscripten/src/relooper.js +11516 -0
- data/modules/emscripten/src/relooper.js.raw.js +11511 -0
- data/modules/emscripten/src/runtime.js +546 -0
- data/modules/emscripten/src/settings.js +1284 -0
- data/modules/emscripten/src/shell.html +92 -0
- data/modules/emscripten/src/shell.js +153 -0
- data/modules/emscripten/src/shell_sharedlib.js +12 -0
- data/modules/emscripten/src/socket.io.js +3870 -0
- data/modules/emscripten/src/utility.js +379 -0
- data/modules/emscripten/src/wrtcp.js +821 -0
- data/modules/emscripten/system/include/AL/al.h +172 -0
- data/modules/emscripten/system/include/AL/alc.h +84 -0
- data/modules/emscripten/system/include/EGL/egl.h +329 -0
- data/modules/emscripten/system/include/EGL/eglext.h +398 -0
- data/modules/emscripten/system/include/EGL/eglplatform.h +141 -0
- data/modules/emscripten/system/include/GL/freeglut_std.h +628 -0
- data/modules/emscripten/system/include/GL/gl.h +2241 -0
- data/modules/emscripten/system/include/GL/glew.h +6 -0
- data/modules/emscripten/system/include/GL/glext.h +11127 -0
- data/modules/emscripten/system/include/GL/glfw.h +518 -0
- data/modules/emscripten/system/include/GL/glu.h +353 -0
- data/modules/emscripten/system/include/GL/glut.h +21 -0
- data/modules/emscripten/system/include/GLES/gl.h +770 -0
- data/modules/emscripten/system/include/GLES/glext.h +1278 -0
- data/modules/emscripten/system/include/GLES/glplatform.h +30 -0
- data/modules/emscripten/system/include/GLES2/gl2.h +621 -0
- data/modules/emscripten/system/include/GLES2/gl2ext.h +803 -0
- data/modules/emscripten/system/include/GLES2/gl2platform.h +30 -0
- data/modules/emscripten/system/include/KHR/khrplatform.h +277 -0
- data/modules/emscripten/system/include/SDL/COPYING +19 -0
- data/modules/emscripten/system/include/SDL/SDL.h +162 -0
- data/modules/emscripten/system/include/SDL/SDL_assert.h +241 -0
- data/modules/emscripten/system/include/SDL/SDL_atomic.h +318 -0
- data/modules/emscripten/system/include/SDL/SDL_audio.h +509 -0
- data/modules/emscripten/system/include/SDL/SDL_blendmode.h +60 -0
- data/modules/emscripten/system/include/SDL/SDL_clipboard.h +75 -0
- data/modules/emscripten/system/include/SDL/SDL_compat.h +365 -0
- data/modules/emscripten/system/include/SDL/SDL_config.h +48 -0
- data/modules/emscripten/system/include/SDL/SDL_config.h.in +297 -0
- data/modules/emscripten/system/include/SDL/SDL_config_android.h +133 -0
- data/modules/emscripten/system/include/SDL/SDL_config_iphoneos.h +148 -0
- data/modules/emscripten/system/include/SDL/SDL_config_macosx.h +172 -0
- data/modules/emscripten/system/include/SDL/SDL_config_minimal.h +74 -0
- data/modules/emscripten/system/include/SDL/SDL_config_nintendods.h +129 -0
- data/modules/emscripten/system/include/SDL/SDL_config_pandora.h +125 -0
- data/modules/emscripten/system/include/SDL/SDL_config_windows.h +207 -0
- data/modules/emscripten/system/include/SDL/SDL_config_wiz.h +119 -0
- data/modules/emscripten/system/include/SDL/SDL_copying.h +20 -0
- data/modules/emscripten/system/include/SDL/SDL_cpuinfo.h +150 -0
- data/modules/emscripten/system/include/SDL/SDL_endian.h +248 -0
- data/modules/emscripten/system/include/SDL/SDL_error.h +77 -0
- data/modules/emscripten/system/include/SDL/SDL_events.h +639 -0
- data/modules/emscripten/system/include/SDL/SDL_gesture.h +91 -0
- data/modules/emscripten/system/include/SDL/SDL_gfxPrimitives.h +246 -0
- data/modules/emscripten/system/include/SDL/SDL_haptic.h +1200 -0
- data/modules/emscripten/system/include/SDL/SDL_hints.h +206 -0
- data/modules/emscripten/system/include/SDL/SDL_image.h +138 -0
- data/modules/emscripten/system/include/SDL/SDL_input.h +87 -0
- data/modules/emscripten/system/include/SDL/SDL_joystick.h +208 -0
- data/modules/emscripten/system/include/SDL/SDL_keyboard.h +169 -0
- data/modules/emscripten/system/include/SDL/SDL_keycode.h +344 -0
- data/modules/emscripten/system/include/SDL/SDL_loadso.h +85 -0
- data/modules/emscripten/system/include/SDL/SDL_log.h +211 -0
- data/modules/emscripten/system/include/SDL/SDL_main.h +98 -0
- data/modules/emscripten/system/include/SDL/SDL_mixer.h +634 -0
- data/modules/emscripten/system/include/SDL/SDL_mouse.h +213 -0
- data/modules/emscripten/system/include/SDL/SDL_mutex.h +248 -0
- data/modules/emscripten/system/include/SDL/SDL_name.h +11 -0
- data/modules/emscripten/system/include/SDL/SDL_opengl.h +11116 -0
- data/modules/emscripten/system/include/SDL/SDL_opengles.h +38 -0
- data/modules/emscripten/system/include/SDL/SDL_opengles2.h +38 -0
- data/modules/emscripten/system/include/SDL/SDL_pixels.h +423 -0
- data/modules/emscripten/system/include/SDL/SDL_platform.h +160 -0
- data/modules/emscripten/system/include/SDL/SDL_power.h +79 -0
- data/modules/emscripten/system/include/SDL/SDL_quit.h +58 -0
- data/modules/emscripten/system/include/SDL/SDL_rect.h +136 -0
- data/modules/emscripten/system/include/SDL/SDL_render.h +615 -0
- data/modules/emscripten/system/include/SDL/SDL_revision.h +2 -0
- data/modules/emscripten/system/include/SDL/SDL_revision.h.orig +2 -0
- data/modules/emscripten/system/include/SDL/SDL_rotozoom.h +123 -0
- data/modules/emscripten/system/include/SDL/SDL_rwops.h +220 -0
- data/modules/emscripten/system/include/SDL/SDL_scancode.h +398 -0
- data/modules/emscripten/system/include/SDL/SDL_shape.h +147 -0
- data/modules/emscripten/system/include/SDL/SDL_stdinc.h +764 -0
- data/modules/emscripten/system/include/SDL/SDL_surface.h +499 -0
- data/modules/emscripten/system/include/SDL/SDL_syswm.h +241 -0
- data/modules/emscripten/system/include/SDL/SDL_thread.h +182 -0
- data/modules/emscripten/system/include/SDL/SDL_timer.h +108 -0
- data/modules/emscripten/system/include/SDL/SDL_touch.h +124 -0
- data/modules/emscripten/system/include/SDL/SDL_ttf.h +249 -0
- data/modules/emscripten/system/include/SDL/SDL_types.h +29 -0
- data/modules/emscripten/system/include/SDL/SDL_version.h +166 -0
- data/modules/emscripten/system/include/SDL/SDL_video.h +820 -0
- data/modules/emscripten/system/include/SDL/begin_code.h +135 -0
- data/modules/emscripten/system/include/SDL/close_code.h +37 -0
- data/modules/emscripten/system/include/X11/X.h +717 -0
- data/modules/emscripten/system/include/X11/Xatom.h +79 -0
- data/modules/emscripten/system/include/X11/Xfuncproto.h +127 -0
- data/modules/emscripten/system/include/X11/Xlib.h +4023 -0
- data/modules/emscripten/system/include/X11/Xosdefs.h +116 -0
- data/modules/emscripten/system/include/X11/Xutil.h +826 -0
- data/modules/emscripten/system/include/X11/keysym.h +73 -0
- data/modules/emscripten/system/include/X11/keysymdef.h +2389 -0
- data/modules/emscripten/system/include/bsd/float.h +91 -0
- data/modules/emscripten/system/include/bsd/readme.txt +2 -0
- data/modules/emscripten/system/include/bsd/sys/mman.h +180 -0
- data/modules/emscripten/system/include/bsd/sys/utsname.h +70 -0
- data/modules/emscripten/system/include/dlfcn.h +31 -0
- data/modules/emscripten/system/include/emscripten/bind.h +1210 -0
- data/modules/emscripten/system/include/emscripten/emscripten.h +388 -0
- data/modules/emscripten/system/include/emscripten/val.h +311 -0
- data/modules/emscripten/system/include/emscripten/wire.h +393 -0
- data/modules/emscripten/system/include/err.h +95 -0
- data/modules/emscripten/system/include/execinfo.h +44 -0
- data/modules/emscripten/system/include/features.h +3 -0
- data/modules/emscripten/system/include/gc.h +70 -0
- data/modules/emscripten/system/include/gfx/png.h +3798 -0
- data/modules/emscripten/system/include/gfx/pngconf.h +1665 -0
- data/modules/emscripten/system/include/gfx/tiff.h +654 -0
- data/modules/emscripten/system/include/gfx/tiffconf.h +104 -0
- data/modules/emscripten/system/include/gfx/tiffio.h +526 -0
- data/modules/emscripten/system/include/gfx/tiffvers.h +9 -0
- data/modules/emscripten/system/include/jansson.h +323 -0
- data/modules/emscripten/system/include/jansson_config.h +54 -0
- data/modules/emscripten/system/include/libc/_ansi.h +135 -0
- data/modules/emscripten/system/include/libc/_syslist.h +40 -0
- data/modules/emscripten/system/include/libc/alloca.h +21 -0
- data/modules/emscripten/system/include/libc/ar.h +69 -0
- data/modules/emscripten/system/include/libc/argz.h +33 -0
- data/modules/emscripten/system/include/libc/assert.h +46 -0
- data/modules/emscripten/system/include/libc/complex.h +124 -0
- data/modules/emscripten/system/include/libc/ctype.h +196 -0
- data/modules/emscripten/system/include/libc/dirent.h +16 -0
- data/modules/emscripten/system/include/libc/endian.h +3 -0
- data/modules/emscripten/system/include/libc/envlock.h +15 -0
- data/modules/emscripten/system/include/libc/envz.h +16 -0
- data/modules/emscripten/system/include/libc/errno.h +11 -0
- data/modules/emscripten/system/include/libc/fastmath.h +13 -0
- data/modules/emscripten/system/include/libc/fcntl.h +1 -0
- data/modules/emscripten/system/include/libc/fnmatch.h +55 -0
- data/modules/emscripten/system/include/libc/getopt.h +196 -0
- data/modules/emscripten/system/include/libc/glob.h +89 -0
- data/modules/emscripten/system/include/libc/grp.h +94 -0
- data/modules/emscripten/system/include/libc/iconv.h +62 -0
- data/modules/emscripten/system/include/libc/ieeefp.h +256 -0
- data/modules/emscripten/system/include/libc/ifaddrs.h +64 -0
- data/modules/emscripten/system/include/libc/inttypes.h +290 -0
- data/modules/emscripten/system/include/libc/iso646.h +43 -0
- data/modules/emscripten/system/include/libc/langinfo.h +316 -0
- data/modules/emscripten/system/include/libc/libgen.h +23 -0
- data/modules/emscripten/system/include/libc/limits.h +155 -0
- data/modules/emscripten/system/include/libc/locale.h +80 -0
- data/modules/emscripten/system/include/libc/machine/_default_types.h +121 -0
- data/modules/emscripten/system/include/libc/machine/_types.h +8 -0
- data/modules/emscripten/system/include/libc/machine/ansi.h +1 -0
- data/modules/emscripten/system/include/libc/machine/endian.h +31 -0
- data/modules/emscripten/system/include/libc/machine/fastmath.h +100 -0
- data/modules/emscripten/system/include/libc/machine/ieeefp.h +376 -0
- data/modules/emscripten/system/include/libc/machine/malloc.h +8 -0
- data/modules/emscripten/system/include/libc/machine/param.h +1 -0
- data/modules/emscripten/system/include/libc/machine/setjmp-dj.h +43 -0
- data/modules/emscripten/system/include/libc/machine/setjmp.h +361 -0
- data/modules/emscripten/system/include/libc/machine/stdlib.h +8 -0
- data/modules/emscripten/system/include/libc/machine/termios.h +1 -0
- data/modules/emscripten/system/include/libc/machine/time.h +19 -0
- data/modules/emscripten/system/include/libc/machine/types.h +30 -0
- data/modules/emscripten/system/include/libc/malloc.h +169 -0
- data/modules/emscripten/system/include/libc/math.h +594 -0
- data/modules/emscripten/system/include/libc/newlib.h +2 -0
- data/modules/emscripten/system/include/libc/paths.h +7 -0
- data/modules/emscripten/system/include/libc/process.h +44 -0
- data/modules/emscripten/system/include/libc/pthread.h +362 -0
- data/modules/emscripten/system/include/libc/pwd.h +78 -0
- data/modules/emscripten/system/include/libc/readme.txt +3 -0
- data/modules/emscripten/system/include/libc/reent.h +183 -0
- data/modules/emscripten/system/include/libc/regdef.h +7 -0
- data/modules/emscripten/system/include/libc/regex.h +102 -0
- data/modules/emscripten/system/include/libc/sched.h +97 -0
- data/modules/emscripten/system/include/libc/search.h +59 -0
- data/modules/emscripten/system/include/libc/setjmp.h +20 -0
- data/modules/emscripten/system/include/libc/signal.h +30 -0
- data/modules/emscripten/system/include/libc/stdarg.h +50 -0
- data/modules/emscripten/system/include/libc/stddef.h +64 -0
- data/modules/emscripten/system/include/libc/stdint.h +493 -0
- data/modules/emscripten/system/include/libc/stdio.h +694 -0
- data/modules/emscripten/system/include/libc/stdlib.h +230 -0
- data/modules/emscripten/system/include/libc/string.h +105 -0
- data/modules/emscripten/system/include/libc/strings.h +35 -0
- data/modules/emscripten/system/include/libc/sys/_default_fcntl.h +223 -0
- data/modules/emscripten/system/include/libc/sys/_types.h +93 -0
- data/modules/emscripten/system/include/libc/sys/cdefs.h +123 -0
- data/modules/emscripten/system/include/libc/sys/config.h +255 -0
- data/modules/emscripten/system/include/libc/sys/custom_file.h +2 -0
- data/modules/emscripten/system/include/libc/sys/dir.h +10 -0
- data/modules/emscripten/system/include/libc/sys/dirent.h +58 -0
- data/modules/emscripten/system/include/libc/sys/errno.h +190 -0
- data/modules/emscripten/system/include/libc/sys/fcntl.h +4 -0
- data/modules/emscripten/system/include/libc/sys/features.h +212 -0
- data/modules/emscripten/system/include/libc/sys/file.h +2 -0
- data/modules/emscripten/system/include/libc/sys/iconvnls.h +77 -0
- data/modules/emscripten/system/include/libc/sys/lock.h +24 -0
- data/modules/emscripten/system/include/libc/sys/param.h +25 -0
- data/modules/emscripten/system/include/libc/sys/queue.h +471 -0
- data/modules/emscripten/system/include/libc/sys/reent.h +843 -0
- data/modules/emscripten/system/include/libc/sys/resource.h +59 -0
- data/modules/emscripten/system/include/libc/sys/sched.h +67 -0
- data/modules/emscripten/system/include/libc/sys/signal.h +314 -0
- data/modules/emscripten/system/include/libc/sys/stat.h +222 -0
- data/modules/emscripten/system/include/libc/sys/stdio.h +27 -0
- data/modules/emscripten/system/include/libc/sys/string.h +2 -0
- data/modules/emscripten/system/include/libc/sys/syslimits.h +65 -0
- data/modules/emscripten/system/include/libc/sys/termios.h +280 -0
- data/modules/emscripten/system/include/libc/sys/time.h +85 -0
- data/modules/emscripten/system/include/libc/sys/timeb.h +39 -0
- data/modules/emscripten/system/include/libc/sys/times.h +28 -0
- data/modules/emscripten/system/include/libc/sys/ttydefaults.h +97 -0
- data/modules/emscripten/system/include/libc/sys/types.h +481 -0
- data/modules/emscripten/system/include/libc/sys/unistd.h +514 -0
- data/modules/emscripten/system/include/libc/sys/utime.h +26 -0
- data/modules/emscripten/system/include/libc/sys/wait.h +40 -0
- data/modules/emscripten/system/include/libc/tar.h +39 -0
- data/modules/emscripten/system/include/libc/termios.h +7 -0
- data/modules/emscripten/system/include/libc/time.h +273 -0
- data/modules/emscripten/system/include/libc/unctrl.h +46 -0
- data/modules/emscripten/system/include/libc/unistd.h +6 -0
- data/modules/emscripten/system/include/libc/utime.h +12 -0
- data/modules/emscripten/system/include/libc/utmp.h +8 -0
- data/modules/emscripten/system/include/libc/wchar.h +194 -0
- data/modules/emscripten/system/include/libc/wctype.h +47 -0
- data/modules/emscripten/system/include/libc/wordexp.h +53 -0
- data/modules/emscripten/system/include/libcxx/CREDITS.TXT +91 -0
- data/modules/emscripten/system/include/libcxx/LICENSE.txt +76 -0
- data/modules/emscripten/system/include/libcxx/__bit_reference +1268 -0
- data/modules/emscripten/system/include/libcxx/__config +485 -0
- data/modules/emscripten/system/include/libcxx/__debug +193 -0
- data/modules/emscripten/system/include/libcxx/__functional_03 +2130 -0
- data/modules/emscripten/system/include/libcxx/__functional_base +437 -0
- data/modules/emscripten/system/include/libcxx/__functional_base_03 +1087 -0
- data/modules/emscripten/system/include/libcxx/__hash_table +1945 -0
- data/modules/emscripten/system/include/libcxx/__locale +1435 -0
- data/modules/emscripten/system/include/libcxx/__mutex_base +438 -0
- data/modules/emscripten/system/include/libcxx/__split_buffer +654 -0
- data/modules/emscripten/system/include/libcxx/__sso_allocator +77 -0
- data/modules/emscripten/system/include/libcxx/__std_stream +317 -0
- data/modules/emscripten/system/include/libcxx/__tree +2293 -0
- data/modules/emscripten/system/include/libcxx/__tuple +305 -0
- data/modules/emscripten/system/include/libcxx/__tuple_03 +27 -0
- data/modules/emscripten/system/include/libcxx/__undef_min_max +19 -0
- data/modules/emscripten/system/include/libcxx/algorithm +5458 -0
- data/modules/emscripten/system/include/libcxx/array +341 -0
- data/modules/emscripten/system/include/libcxx/atomic +1521 -0
- data/modules/emscripten/system/include/libcxx/bitset +1081 -0
- data/modules/emscripten/system/include/libcxx/cassert +25 -0
- data/modules/emscripten/system/include/libcxx/ccomplex +29 -0
- data/modules/emscripten/system/include/libcxx/cctype +164 -0
- data/modules/emscripten/system/include/libcxx/cerrno +393 -0
- data/modules/emscripten/system/include/libcxx/cfenv +82 -0
- data/modules/emscripten/system/include/libcxx/cfloat +78 -0
- data/modules/emscripten/system/include/libcxx/chrono +898 -0
- data/modules/emscripten/system/include/libcxx/cinttypes +259 -0
- data/modules/emscripten/system/include/libcxx/ciso646 +25 -0
- data/modules/emscripten/system/include/libcxx/climits +48 -0
- data/modules/emscripten/system/include/libcxx/clocale +53 -0
- data/modules/emscripten/system/include/libcxx/cmath +1683 -0
- data/modules/emscripten/system/include/libcxx/codecvt +547 -0
- data/modules/emscripten/system/include/libcxx/complex +1526 -0
- data/modules/emscripten/system/include/libcxx/complex.h +35 -0
- data/modules/emscripten/system/include/libcxx/condition_variable +256 -0
- data/modules/emscripten/system/include/libcxx/csetjmp +52 -0
- data/modules/emscripten/system/include/libcxx/csignal +58 -0
- data/modules/emscripten/system/include/libcxx/cstdarg +48 -0
- data/modules/emscripten/system/include/libcxx/cstdbool +32 -0
- data/modules/emscripten/system/include/libcxx/cstddef +103 -0
- data/modules/emscripten/system/include/libcxx/cstdint +191 -0
- data/modules/emscripten/system/include/libcxx/cstdio +175 -0
- data/modules/emscripten/system/include/libcxx/cstdlib +172 -0
- data/modules/emscripten/system/include/libcxx/cstring +112 -0
- data/modules/emscripten/system/include/libcxx/ctgmath +29 -0
- data/modules/emscripten/system/include/libcxx/ctime +72 -0
- data/modules/emscripten/system/include/libcxx/cwchar +208 -0
- data/modules/emscripten/system/include/libcxx/cwctype +213 -0
- data/modules/emscripten/system/include/libcxx/deque +2846 -0
- data/modules/emscripten/system/include/libcxx/exception +250 -0
- data/modules/emscripten/system/include/libcxx/ext/__hash +46 -0
- data/modules/emscripten/system/include/libcxx/ext/hash_map +1003 -0
- data/modules/emscripten/system/include/libcxx/ext/hash_set +657 -0
- data/modules/emscripten/system/include/libcxx/forward_list +1636 -0
- data/modules/emscripten/system/include/libcxx/fstream +1415 -0
- data/modules/emscripten/system/include/libcxx/functional +2063 -0
- data/modules/emscripten/system/include/libcxx/future +2505 -0
- data/modules/emscripten/system/include/libcxx/initializer_list +105 -0
- data/modules/emscripten/system/include/libcxx/iomanip +504 -0
- data/modules/emscripten/system/include/libcxx/ios +988 -0
- data/modules/emscripten/system/include/libcxx/iosfwd +194 -0
- data/modules/emscripten/system/include/libcxx/iostream +60 -0
- data/modules/emscripten/system/include/libcxx/istream +1713 -0
- data/modules/emscripten/system/include/libcxx/iterator +1869 -0
- data/modules/emscripten/system/include/libcxx/limits +809 -0
- data/modules/emscripten/system/include/libcxx/list +2275 -0
- data/modules/emscripten/system/include/libcxx/locale +4591 -0
- data/modules/emscripten/system/include/libcxx/map +1924 -0
- data/modules/emscripten/system/include/libcxx/memory +5437 -0
- data/modules/emscripten/system/include/libcxx/mutex +566 -0
- data/modules/emscripten/system/include/libcxx/new +117 -0
- data/modules/emscripten/system/include/libcxx/numeric +197 -0
- data/modules/emscripten/system/include/libcxx/ostream +1286 -0
- data/modules/emscripten/system/include/libcxx/queue +717 -0
- data/modules/emscripten/system/include/libcxx/random +6750 -0
- data/modules/emscripten/system/include/libcxx/ratio +487 -0
- data/modules/emscripten/system/include/libcxx/readme.txt +1 -0
- data/modules/emscripten/system/include/libcxx/regex +6439 -0
- data/modules/emscripten/system/include/libcxx/scoped_allocator +578 -0
- data/modules/emscripten/system/include/libcxx/set +1025 -0
- data/modules/emscripten/system/include/libcxx/sstream +888 -0
- data/modules/emscripten/system/include/libcxx/stack +292 -0
- data/modules/emscripten/system/include/libcxx/stdexcept +162 -0
- data/modules/emscripten/system/include/libcxx/streambuf +564 -0
- data/modules/emscripten/system/include/libcxx/string +3987 -0
- data/modules/emscripten/system/include/libcxx/strstream +400 -0
- data/modules/emscripten/system/include/libcxx/support/solaris/floatingpoint.h +5 -0
- data/modules/emscripten/system/include/libcxx/support/solaris/wchar.h +38 -0
- data/modules/emscripten/system/include/libcxx/support/solaris/xlocale.h +146 -0
- data/modules/emscripten/system/include/libcxx/support/win32/limits_win32.h +79 -0
- data/modules/emscripten/system/include/libcxx/support/win32/locale_win32.h +116 -0
- data/modules/emscripten/system/include/libcxx/support/win32/math_win32.h +113 -0
- data/modules/emscripten/system/include/libcxx/support/win32/support.h +115 -0
- data/modules/emscripten/system/include/libcxx/system_error +636 -0
- data/modules/emscripten/system/include/libcxx/tgmath.h +29 -0
- data/modules/emscripten/system/include/libcxx/thread +459 -0
- data/modules/emscripten/system/include/libcxx/tuple +1092 -0
- data/modules/emscripten/system/include/libcxx/type_traits +3040 -0
- data/modules/emscripten/system/include/libcxx/typeindex +103 -0
- data/modules/emscripten/system/include/libcxx/typeinfo +124 -0
- data/modules/emscripten/system/include/libcxx/unordered_map +1864 -0
- data/modules/emscripten/system/include/libcxx/unordered_set +1144 -0
- data/modules/emscripten/system/include/libcxx/utility +583 -0
- data/modules/emscripten/system/include/libcxx/valarray +4779 -0
- data/modules/emscripten/system/include/libcxx/vector +3228 -0
- data/modules/emscripten/system/include/memory.h +10 -0
- data/modules/emscripten/system/include/mntent.h +23 -0
- data/modules/emscripten/system/include/net/arpa/inet.h +32 -0
- data/modules/emscripten/system/include/net/arpa/nameser.h +535 -0
- data/modules/emscripten/system/include/net/arpa/nameser_compat.h +187 -0
- data/modules/emscripten/system/include/net/if.h +87 -0
- data/modules/emscripten/system/include/net/netinet/in.h +166 -0
- data/modules/emscripten/system/include/net/netinet/tcp.h +246 -0
- data/modules/emscripten/system/include/net/resolv.h +389 -0
- data/modules/emscripten/system/include/netdb.h +94 -0
- data/modules/emscripten/system/include/nl_types.h +19 -0
- data/modules/emscripten/system/include/poll.h +3 -0
- data/modules/emscripten/system/include/pty.h +6 -0
- data/modules/emscripten/system/include/semaphore.h +31 -0
- data/modules/emscripten/system/include/spawn.h +105 -0
- data/modules/emscripten/system/include/stdbool.h +16 -0
- data/modules/emscripten/system/include/sys/bitypes.h +3 -0
- data/modules/emscripten/system/include/sys/io.h +14 -0
- data/modules/emscripten/system/include/sys/ioctl.h +26 -0
- data/modules/emscripten/system/include/sys/poll.h +31 -0
- data/modules/emscripten/system/include/sys/select.h +14 -0
- data/modules/emscripten/system/include/sys/socket.h +101 -0
- data/modules/emscripten/system/include/sys/socketvar.h +3 -0
- data/modules/emscripten/system/include/sys/statvfs.h +32 -0
- data/modules/emscripten/system/include/sys/sysctl.h +14 -0
- data/modules/emscripten/system/include/sys/uio.h +22 -0
- data/modules/emscripten/system/include/sys/un.h +66 -0
- data/modules/emscripten/system/include/sysexits.h +108 -0
- data/modules/emscripten/system/include/unwind.h +154 -0
- data/modules/emscripten/system/include/xlocale.h +47 -0
- data/modules/emscripten/system/include/zconf.h +428 -0
- data/modules/emscripten/system/include/zlib.h +1613 -0
- data/modules/emscripten/system/lib/compiler-rt/LICENSE.TXT +97 -0
- data/modules/emscripten/system/lib/compiler-rt/divdi3.c +47 -0
- data/modules/emscripten/system/lib/compiler-rt/int_endianness.h +116 -0
- data/modules/emscripten/system/lib/compiler-rt/int_lib.h +46 -0
- data/modules/emscripten/system/lib/compiler-rt/int_math.h +67 -0
- data/modules/emscripten/system/lib/compiler-rt/int_types.h +140 -0
- data/modules/emscripten/system/lib/compiler-rt/int_util.h +29 -0
- data/modules/emscripten/system/lib/compiler-rt/muldi3.c +56 -0
- data/modules/emscripten/system/lib/compiler-rt/readme.txt +20 -0
- data/modules/emscripten/system/lib/compiler-rt/udivdi3.c +36 -0
- data/modules/emscripten/system/lib/compiler-rt/udivmoddi4.c +251 -0
- data/modules/emscripten/system/lib/debugging.cpp +24 -0
- data/modules/emscripten/system/lib/dlmalloc.c +6299 -0
- data/modules/emscripten/system/lib/embind/bind.cpp +63 -0
- data/modules/emscripten/system/lib/libc/gen/err.c +49 -0
- data/modules/emscripten/system/lib/libc/gen/errx.c +49 -0
- data/modules/emscripten/system/lib/libc/gen/verr.c +58 -0
- data/modules/emscripten/system/lib/libc/gen/verrx.c +51 -0
- data/modules/emscripten/system/lib/libc/gen/vwarn.c +55 -0
- data/modules/emscripten/system/lib/libc/gen/vwarnx.c +48 -0
- data/modules/emscripten/system/lib/libc/gen/warn.c +49 -0
- data/modules/emscripten/system/lib/libc/gen/warnx.c +49 -0
- data/modules/emscripten/system/lib/libc/musl/COPYRIGHT +92 -0
- data/modules/emscripten/system/lib/libc/musl/readme.txt +1 -0
- data/modules/emscripten/system/lib/libc/musl/src/ctype/alpha.h +125 -0
- data/modules/emscripten/system/lib/libc/musl/src/ctype/iswalnum.c +7 -0
- data/modules/emscripten/system/lib/libc/musl/src/ctype/iswalpha.c +14 -0
- data/modules/emscripten/system/lib/libc/musl/src/ctype/iswblank.c +8 -0
- data/modules/emscripten/system/lib/libc/musl/src/ctype/iswcntrl.c +10 -0
- data/modules/emscripten/system/lib/libc/musl/src/ctype/iswctype.c +63 -0
- data/modules/emscripten/system/lib/libc/musl/src/ctype/iswdigit.c +9 -0
- data/modules/emscripten/system/lib/libc/musl/src/ctype/iswgraph.c +7 -0
- data/modules/emscripten/system/lib/libc/musl/src/ctype/iswlower.c +6 -0
- data/modules/emscripten/system/lib/libc/musl/src/ctype/iswprint.c +19 -0
- data/modules/emscripten/system/lib/libc/musl/src/ctype/iswpunct.c +12 -0
- data/modules/emscripten/system/lib/libc/musl/src/ctype/iswspace.c +19 -0
- data/modules/emscripten/system/lib/libc/musl/src/ctype/iswupper.c +6 -0
- data/modules/emscripten/system/lib/libc/musl/src/ctype/iswxdigit.c +7 -0
- data/modules/emscripten/system/lib/libc/musl/src/ctype/nonspacing.h +62 -0
- data/modules/emscripten/system/lib/libc/musl/src/ctype/punct.h +109 -0
- data/modules/emscripten/system/lib/libc/musl/src/ctype/towctrans.c +268 -0
- data/modules/emscripten/system/lib/libc/musl/src/ctype/wcswidth.c +8 -0
- data/modules/emscripten/system/lib/libc/musl/src/ctype/wctrans.c +16 -0
- data/modules/emscripten/system/lib/libc/musl/src/ctype/wcwidth.c +29 -0
- data/modules/emscripten/system/lib/libc/musl/src/ctype/wide.h +42 -0
- data/modules/emscripten/system/lib/libc/musl/src/internal/libc.c +22 -0
- data/modules/emscripten/system/lib/libc/musl/src/internal/libc.h +71 -0
- data/modules/emscripten/system/lib/libc/musl/src/multibyte/btowc.c +7 -0
- data/modules/emscripten/system/lib/libc/musl/src/multibyte/internal.c +38 -0
- data/modules/emscripten/system/lib/libc/musl/src/multibyte/internal.h +22 -0
- data/modules/emscripten/system/lib/libc/musl/src/multibyte/mblen.c +17 -0
- data/modules/emscripten/system/lib/libc/musl/src/multibyte/mbrlen.c +18 -0
- data/modules/emscripten/system/lib/libc/musl/src/multibyte/mbrtowc.c +57 -0
- data/modules/emscripten/system/lib/libc/musl/src/multibyte/mbsinit.c +17 -0
- data/modules/emscripten/system/lib/libc/musl/src/multibyte/mbsnrtowcs.c +65 -0
- data/modules/emscripten/system/lib/libc/musl/src/multibyte/mbsrtowcs.c +100 -0
- data/modules/emscripten/system/lib/libc/musl/src/multibyte/mbstowcs.c +7 -0
- data/modules/emscripten/system/lib/libc/musl/src/multibyte/mbtowc.c +53 -0
- data/modules/emscripten/system/lib/libc/musl/src/multibyte/wcrtomb.c +38 -0
- data/modules/emscripten/system/lib/libc/musl/src/multibyte/wcsnrtombs.c +52 -0
- data/modules/emscripten/system/lib/libc/musl/src/multibyte/wcsrtombs.c +58 -0
- data/modules/emscripten/system/lib/libc/musl/src/multibyte/wcstombs.c +7 -0
- data/modules/emscripten/system/lib/libc/musl/src/multibyte/wctob.c +8 -0
- data/modules/emscripten/system/lib/libc/musl/src/multibyte/wctomb.c +18 -0
- data/modules/emscripten/system/lib/libc/musl/src/string/wcpcpy.c +6 -0
- data/modules/emscripten/system/lib/libc/musl/src/string/wcpncpy.c +6 -0
- data/modules/emscripten/system/lib/libc/musl/src/string/wcscasecmp.c +7 -0
- data/modules/emscripten/system/lib/libc/musl/src/string/wcscasecmp_l.c +6 -0
- data/modules/emscripten/system/lib/libc/musl/src/string/wcscat.c +7 -0
- data/modules/emscripten/system/lib/libc/musl/src/string/wcschr.c +8 -0
- data/modules/emscripten/system/lib/libc/musl/src/string/wcscmp.c +7 -0
- data/modules/emscripten/system/lib/libc/musl/src/string/wcscpy.c +8 -0
- data/modules/emscripten/system/lib/libc/musl/src/string/wcscspn.c +10 -0
- data/modules/emscripten/system/lib/libc/musl/src/string/wcsdup.c +11 -0
- data/modules/emscripten/system/lib/libc/musl/src/string/wcslen.c +8 -0
- data/modules/emscripten/system/lib/libc/musl/src/string/wcsncasecmp.c +9 -0
- data/modules/emscripten/system/lib/libc/musl/src/string/wcsncasecmp_l.c +6 -0
- data/modules/emscripten/system/lib/libc/musl/src/string/wcsncat.c +10 -0
- data/modules/emscripten/system/lib/libc/musl/src/string/wcsncmp.c +7 -0
- data/modules/emscripten/system/lib/libc/musl/src/string/wcsncpy.c +9 -0
- data/modules/emscripten/system/lib/libc/musl/src/string/wcsnlen.c +8 -0
- data/modules/emscripten/system/lib/libc/musl/src/string/wcspbrk.c +7 -0
- data/modules/emscripten/system/lib/libc/musl/src/string/wcsrchr.c +8 -0
- data/modules/emscripten/system/lib/libc/musl/src/string/wcsspn.c +8 -0
- data/modules/emscripten/system/lib/libc/musl/src/string/wcsstr.c +108 -0
- data/modules/emscripten/system/lib/libc/musl/src/string/wcstok.c +12 -0
- data/modules/emscripten/system/lib/libc/musl/src/string/wcswcs.c +6 -0
- data/modules/emscripten/system/lib/libc/musl/src/string/wmemchr.c +8 -0
- data/modules/emscripten/system/lib/libc/musl/src/string/wmemcmp.c +8 -0
- data/modules/emscripten/system/lib/libc/musl/src/string/wmemcpy.c +9 -0
- data/modules/emscripten/system/lib/libc/musl/src/string/wmemmove.c +12 -0
- data/modules/emscripten/system/lib/libc/musl/src/string/wmemset.c +9 -0
- data/modules/emscripten/system/lib/libc/stdlib/getopt_long.c +511 -0
- data/modules/emscripten/system/lib/libc/stdlib/strtod.c +305 -0
- data/modules/emscripten/system/lib/libc.symbols +81 -0
- data/modules/emscripten/system/lib/libcextra.symbols +61 -0
- data/modules/emscripten/system/lib/libcxx/CREDITS.TXT +91 -0
- data/modules/emscripten/system/lib/libcxx/LICENSE.txt +76 -0
- data/modules/emscripten/system/lib/libcxx/algorithm.cpp +83 -0
- data/modules/emscripten/system/lib/libcxx/bind.cpp +30 -0
- data/modules/emscripten/system/lib/libcxx/chrono.cpp +132 -0
- data/modules/emscripten/system/lib/libcxx/condition_variable.cpp +81 -0
- data/modules/emscripten/system/lib/libcxx/debug.cpp +504 -0
- data/modules/emscripten/system/lib/libcxx/exception.cpp +226 -0
- data/modules/emscripten/system/lib/libcxx/future.cpp +285 -0
- data/modules/emscripten/system/lib/libcxx/hash.cpp +564 -0
- data/modules/emscripten/system/lib/libcxx/ios.cpp +455 -0
- data/modules/emscripten/system/lib/libcxx/iostream.cpp +68 -0
- data/modules/emscripten/system/lib/libcxx/locale.cpp +6093 -0
- data/modules/emscripten/system/lib/libcxx/memory.cpp +223 -0
- data/modules/emscripten/system/lib/libcxx/mutex.cpp +250 -0
- data/modules/emscripten/system/lib/libcxx/new.cpp +205 -0
- data/modules/emscripten/system/lib/libcxx/random.cpp +48 -0
- data/modules/emscripten/system/lib/libcxx/readme.txt +1 -0
- data/modules/emscripten/system/lib/libcxx/regex.cpp +325 -0
- data/modules/emscripten/system/lib/libcxx/stdexcept.cpp +196 -0
- data/modules/emscripten/system/lib/libcxx/string.cpp +687 -0
- data/modules/emscripten/system/lib/libcxx/strstream.cpp +329 -0
- data/modules/emscripten/system/lib/libcxx/support/solaris/README +4 -0
- data/modules/emscripten/system/lib/libcxx/support/solaris/mbsnrtowcs.inc +76 -0
- data/modules/emscripten/system/lib/libcxx/support/solaris/wcsnrtombs.inc +93 -0
- data/modules/emscripten/system/lib/libcxx/support/solaris/xlocale.c +245 -0
- data/modules/emscripten/system/lib/libcxx/support/win32/locale_win32.cpp +94 -0
- data/modules/emscripten/system/lib/libcxx/support/win32/support.cpp +70 -0
- data/modules/emscripten/system/lib/libcxx/symbols +2927 -0
- data/modules/emscripten/system/lib/libcxx/system_error.cpp +201 -0
- data/modules/emscripten/system/lib/libcxx/thread.cpp +208 -0
- data/modules/emscripten/system/lib/libcxx/typeinfo.cpp +60 -0
- data/modules/emscripten/system/lib/libcxx/utility.cpp +17 -0
- data/modules/emscripten/system/lib/libcxx/valarray.cpp +54 -0
- data/modules/emscripten/system/lib/libcxxabi/CREDITS.TXT +38 -0
- data/modules/emscripten/system/lib/libcxxabi/LICENSE.TXT +76 -0
- data/modules/emscripten/system/lib/libcxxabi/include/cxa_demangle.h +167 -0
- data/modules/emscripten/system/lib/libcxxabi/include/cxxabi.h +175 -0
- data/modules/emscripten/system/lib/libcxxabi/lib/buildit +99 -0
- data/modules/emscripten/system/lib/libcxxabi/readme.txt +1 -0
- data/modules/emscripten/system/lib/libcxxabi/src/abort_message.cpp +50 -0
- data/modules/emscripten/system/lib/libcxxabi/src/abort_message.h +33 -0
- data/modules/emscripten/system/lib/libcxxabi/src/cxa_aux_runtime.cpp +34 -0
- data/modules/emscripten/system/lib/libcxxabi/src/cxa_demangle.cpp +11036 -0
- data/modules/emscripten/system/lib/libcxxabi/src/cxa_exception.cpp +622 -0
- data/modules/emscripten/system/lib/libcxxabi/src/cxa_exception.hpp +123 -0
- data/modules/emscripten/system/lib/libcxxabi/src/cxa_exception_storage.cpp +91 -0
- data/modules/emscripten/system/lib/libcxxabi/src/cxa_guard.cpp +231 -0
- data/modules/emscripten/system/lib/libcxxabi/src/cxa_handlers.cpp +125 -0
- data/modules/emscripten/system/lib/libcxxabi/src/cxa_handlers.hpp +54 -0
- data/modules/emscripten/system/lib/libcxxabi/src/cxa_new_delete.cpp +242 -0
- data/modules/emscripten/system/lib/libcxxabi/src/cxa_personality.cpp +1055 -0
- data/modules/emscripten/system/lib/libcxxabi/src/cxa_unexpected.cpp +27 -0
- data/modules/emscripten/system/lib/libcxxabi/src/cxa_vector.cpp +367 -0
- data/modules/emscripten/system/lib/libcxxabi/src/cxa_virtual.cpp +31 -0
- data/modules/emscripten/system/lib/libcxxabi/src/exception.cpp +41 -0
- data/modules/emscripten/system/lib/libcxxabi/src/fallback_malloc.ipp +174 -0
- data/modules/emscripten/system/lib/libcxxabi/src/private_typeinfo.cpp +1146 -0
- data/modules/emscripten/system/lib/libcxxabi/src/private_typeinfo.h +248 -0
- data/modules/emscripten/system/lib/libcxxabi/src/stdexcept.cpp +169 -0
- data/modules/emscripten/system/lib/libcxxabi/src/typeinfo.cpp +53 -0
- data/modules/emscripten/system/lib/libcxxabi/symbols +236 -0
- data/modules/emscripten/system/lib/sdl.cpp +13 -0
- data/modules/emscripten/system/lib/sdl.symbols +1 -0
- data/modules/emscripten/tests/hello_world.js +92 -0
- data/modules/emscripten/third_party/CppHeaderParser/CppHeaderParser/CppHeaderParser.py +2347 -0
- data/modules/emscripten/third_party/CppHeaderParser/CppHeaderParser/__init__.py +4 -0
- data/modules/emscripten/third_party/CppHeaderParser/CppHeaderParser/doc/CppHeaderParser.html +657 -0
- data/modules/emscripten/third_party/CppHeaderParser/CppHeaderParser/examples/SampleClass.h +147 -0
- data/modules/emscripten/third_party/CppHeaderParser/CppHeaderParser/examples/readSampleClass.py +74 -0
- data/modules/emscripten/third_party/CppHeaderParser/PKG-INFO +249 -0
- data/modules/emscripten/third_party/CppHeaderParser/README.html +544 -0
- data/modules/emscripten/third_party/CppHeaderParser/README.txt +226 -0
- data/modules/emscripten/third_party/CppHeaderParser/setup.py +43 -0
- data/modules/emscripten/third_party/ansidecl.h +371 -0
- data/modules/emscripten/third_party/closure-compiler/COPYING +202 -0
- data/modules/emscripten/third_party/closure-compiler/README +292 -0
- data/modules/emscripten/third_party/closure-compiler/compiler.jar +0 -0
- data/modules/emscripten/third_party/closure-compiler/readme.txt +3 -0
- data/modules/emscripten/third_party/cp-demangle.h +161 -0
- data/modules/emscripten/third_party/demangle.h +549 -0
- data/modules/emscripten/third_party/demangler.py +49 -0
- data/modules/emscripten/third_party/gcc_demangler.c +4226 -0
- data/modules/emscripten/third_party/gcc_demangler.js +21282 -0
- data/modules/emscripten/third_party/jni/emjvm.cpp +133 -0
- data/modules/emscripten/third_party/jni/emjvm.h +8 -0
- data/modules/emscripten/third_party/jni/emjvm.js +185 -0
- data/modules/emscripten/third_party/jni/jni.h +1154 -0
- data/modules/emscripten/third_party/libiberty.h +634 -0
- data/modules/emscripten/third_party/lzma.js/README.markdown +37 -0
- data/modules/emscripten/third_party/lzma.js/doit.sh +37 -0
- data/modules/emscripten/third_party/lzma.js/lzip/AUTHORS +7 -0
- data/modules/emscripten/third_party/lzma.js/lzip/COPYING +676 -0
- data/modules/emscripten/third_party/lzma.js/lzip/ChangeLog +201 -0
- data/modules/emscripten/third_party/lzma.js/lzip/INSTALL +56 -0
- data/modules/emscripten/third_party/lzma.js/lzip/Makefile +160 -0
- data/modules/emscripten/third_party/lzma.js/lzip/Makefile.in +138 -0
- data/modules/emscripten/third_party/lzma.js/lzip/NEWS +22 -0
- data/modules/emscripten/third_party/lzma.js/lzip/README +77 -0
- data/modules/emscripten/third_party/lzma.js/lzip/arg_parser.cc +204 -0
- data/modules/emscripten/third_party/lzma.js/lzip/arg_parser.h +106 -0
- data/modules/emscripten/third_party/lzma.js/lzip/configure +192 -0
- data/modules/emscripten/third_party/lzma.js/lzip/decoder.cc +252 -0
- data/modules/emscripten/third_party/lzma.js/lzip/decoder.h +268 -0
- data/modules/emscripten/third_party/lzma.js/lzip/encoder.cc +643 -0
- data/modules/emscripten/third_party/lzma.js/lzip/encoder.h +582 -0
- data/modules/emscripten/third_party/lzma.js/lzip/fast_encoder.cc +378 -0
- data/modules/emscripten/third_party/lzma.js/lzip/fast_encoder.h +171 -0
- data/modules/emscripten/third_party/lzma.js/lzip/lzip.h +264 -0
- data/modules/emscripten/third_party/lzma.js/lzip/main.cc +545 -0
- data/modules/emscripten/third_party/lzma.js/lzma-decoder.js +27 -0
- data/modules/emscripten/third_party/lzma.js/lzma-full.js +27 -0
- data/modules/emscripten/third_party/lzma.js/native_test.sh +5 -0
- data/modules/emscripten/third_party/lzma.js/post.js +13 -0
- data/modules/emscripten/third_party/lzma.js/pre.js +13 -0
- data/modules/emscripten/third_party/lzma.js/test-decoder.js +39 -0
- data/modules/emscripten/third_party/lzma.js/test-full.html +9 -0
- data/modules/emscripten/third_party/lzma.js/test-full.js +78 -0
- data/modules/emscripten/third_party/ply/ANNOUNCE +40 -0
- data/modules/emscripten/third_party/ply/CHANGES +1093 -0
- data/modules/emscripten/third_party/ply/PKG-INFO +22 -0
- data/modules/emscripten/third_party/ply/README +271 -0
- data/modules/emscripten/third_party/ply/TODO +16 -0
- data/modules/emscripten/third_party/ply/doc/internal.html +874 -0
- data/modules/emscripten/third_party/ply/doc/makedoc.py +194 -0
- data/modules/emscripten/third_party/ply/doc/ply.html +3262 -0
- data/modules/emscripten/third_party/ply/example/BASIC/README +79 -0
- data/modules/emscripten/third_party/ply/example/BASIC/basic.py +71 -0
- data/modules/emscripten/third_party/ply/example/BASIC/basiclex.py +74 -0
- data/modules/emscripten/third_party/ply/example/BASIC/basiclog.py +79 -0
- data/modules/emscripten/third_party/ply/example/BASIC/basinterp.py +441 -0
- data/modules/emscripten/third_party/ply/example/BASIC/basparse.py +424 -0
- data/modules/emscripten/third_party/ply/example/BASIC/dim.bas +14 -0
- data/modules/emscripten/third_party/ply/example/BASIC/func.bas +5 -0
- data/modules/emscripten/third_party/ply/example/BASIC/gcd.bas +22 -0
- data/modules/emscripten/third_party/ply/example/BASIC/gosub.bas +13 -0
- data/modules/emscripten/third_party/ply/example/BASIC/hello.bas +4 -0
- data/modules/emscripten/third_party/ply/example/BASIC/linear.bas +17 -0
- data/modules/emscripten/third_party/ply/example/BASIC/maxsin.bas +12 -0
- data/modules/emscripten/third_party/ply/example/BASIC/powers.bas +13 -0
- data/modules/emscripten/third_party/ply/example/BASIC/rand.bas +4 -0
- data/modules/emscripten/third_party/ply/example/BASIC/sales.bas +20 -0
- data/modules/emscripten/third_party/ply/example/BASIC/sears.bas +18 -0
- data/modules/emscripten/third_party/ply/example/BASIC/sqrt1.bas +5 -0
- data/modules/emscripten/third_party/ply/example/BASIC/sqrt2.bas +4 -0
- data/modules/emscripten/third_party/ply/example/GardenSnake/GardenSnake.py +709 -0
- data/modules/emscripten/third_party/ply/example/GardenSnake/README +5 -0
- data/modules/emscripten/third_party/ply/example/README +10 -0
- data/modules/emscripten/third_party/ply/example/ansic/README +2 -0
- data/modules/emscripten/third_party/ply/example/ansic/clex.py +164 -0
- data/modules/emscripten/third_party/ply/example/ansic/cparse.py +863 -0
- data/modules/emscripten/third_party/ply/example/calc/calc.py +107 -0
- data/modules/emscripten/third_party/ply/example/calcdebug/calc.py +113 -0
- data/modules/emscripten/third_party/ply/example/classcalc/calc.py +157 -0
- data/modules/emscripten/third_party/ply/example/cleanup.sh +2 -0
- data/modules/emscripten/third_party/ply/example/closurecalc/calc.py +130 -0
- data/modules/emscripten/third_party/ply/example/hedit/hedit.py +48 -0
- data/modules/emscripten/third_party/ply/example/newclasscalc/calc.py +160 -0
- data/modules/emscripten/third_party/ply/example/optcalc/README +9 -0
- data/modules/emscripten/third_party/ply/example/optcalc/calc.py +119 -0
- data/modules/emscripten/third_party/ply/example/unicalc/calc.py +117 -0
- data/modules/emscripten/third_party/ply/example/yply/README +41 -0
- data/modules/emscripten/third_party/ply/example/yply/ylex.py +112 -0
- data/modules/emscripten/third_party/ply/example/yply/yparse.py +217 -0
- data/modules/emscripten/third_party/ply/example/yply/yply.py +53 -0
- data/modules/emscripten/third_party/ply/ply/__init__.py +4 -0
- data/modules/emscripten/third_party/ply/ply/cpp.py +898 -0
- data/modules/emscripten/third_party/ply/ply/ctokens.py +133 -0
- data/modules/emscripten/third_party/ply/ply/lex.py +1058 -0
- data/modules/emscripten/third_party/ply/ply/yacc.py +3276 -0
- data/modules/emscripten/third_party/ply/setup.py +31 -0
- data/modules/emscripten/third_party/ply/test/README +7 -0
- data/modules/emscripten/third_party/ply/test/calclex.py +49 -0
- data/modules/emscripten/third_party/ply/test/cleanup.sh +4 -0
- data/modules/emscripten/third_party/ply/test/lex_closure.py +54 -0
- data/modules/emscripten/third_party/ply/test/lex_doc1.py +26 -0
- data/modules/emscripten/third_party/ply/test/lex_dup1.py +29 -0
- data/modules/emscripten/third_party/ply/test/lex_dup2.py +33 -0
- data/modules/emscripten/third_party/ply/test/lex_dup3.py +31 -0
- data/modules/emscripten/third_party/ply/test/lex_empty.py +20 -0
- data/modules/emscripten/third_party/ply/test/lex_error1.py +24 -0
- data/modules/emscripten/third_party/ply/test/lex_error2.py +26 -0
- data/modules/emscripten/third_party/ply/test/lex_error3.py +27 -0
- data/modules/emscripten/third_party/ply/test/lex_error4.py +27 -0
- data/modules/emscripten/third_party/ply/test/lex_hedit.py +47 -0
- data/modules/emscripten/third_party/ply/test/lex_ignore.py +31 -0
- data/modules/emscripten/third_party/ply/test/lex_ignore2.py +29 -0
- data/modules/emscripten/third_party/ply/test/lex_literal1.py +25 -0
- data/modules/emscripten/third_party/ply/test/lex_literal2.py +25 -0
- data/modules/emscripten/third_party/ply/test/lex_many_tokens.py +27 -0
- data/modules/emscripten/third_party/ply/test/lex_module.py +10 -0
- data/modules/emscripten/third_party/ply/test/lex_module_import.py +42 -0
- data/modules/emscripten/third_party/ply/test/lex_object.py +55 -0
- data/modules/emscripten/third_party/ply/test/lex_opt_alias.py +54 -0
- data/modules/emscripten/third_party/ply/test/lex_optimize.py +50 -0
- data/modules/emscripten/third_party/ply/test/lex_optimize2.py +50 -0
- data/modules/emscripten/third_party/ply/test/lex_optimize3.py +52 -0
- data/modules/emscripten/third_party/ply/test/lex_re1.py +27 -0
- data/modules/emscripten/third_party/ply/test/lex_re2.py +27 -0
- data/modules/emscripten/third_party/ply/test/lex_re3.py +29 -0
- data/modules/emscripten/third_party/ply/test/lex_rule1.py +27 -0
- data/modules/emscripten/third_party/ply/test/lex_rule2.py +29 -0
- data/modules/emscripten/third_party/ply/test/lex_rule3.py +27 -0
- data/modules/emscripten/third_party/ply/test/lex_state1.py +40 -0
- data/modules/emscripten/third_party/ply/test/lex_state2.py +40 -0
- data/modules/emscripten/third_party/ply/test/lex_state3.py +42 -0
- data/modules/emscripten/third_party/ply/test/lex_state4.py +41 -0
- data/modules/emscripten/third_party/ply/test/lex_state5.py +40 -0
- data/modules/emscripten/third_party/ply/test/lex_state_noerror.py +39 -0
- data/modules/emscripten/third_party/ply/test/lex_state_norule.py +40 -0
- data/modules/emscripten/third_party/ply/test/lex_state_try.py +45 -0
- data/modules/emscripten/third_party/ply/test/lex_token1.py +19 -0
- data/modules/emscripten/third_party/ply/test/lex_token2.py +22 -0
- data/modules/emscripten/third_party/ply/test/lex_token3.py +24 -0
- data/modules/emscripten/third_party/ply/test/lex_token4.py +26 -0
- data/modules/emscripten/third_party/ply/test/lex_token5.py +31 -0
- data/modules/emscripten/third_party/ply/test/lex_token_dup.py +29 -0
- data/modules/emscripten/third_party/ply/test/testlex.py +606 -0
- data/modules/emscripten/third_party/ply/test/testyacc.py +347 -0
- data/modules/emscripten/third_party/ply/test/yacc_badargs.py +68 -0
- data/modules/emscripten/third_party/ply/test/yacc_badid.py +77 -0
- data/modules/emscripten/third_party/ply/test/yacc_badprec.py +64 -0
- data/modules/emscripten/third_party/ply/test/yacc_badprec2.py +68 -0
- data/modules/emscripten/third_party/ply/test/yacc_badprec3.py +68 -0
- data/modules/emscripten/third_party/ply/test/yacc_badrule.py +68 -0
- data/modules/emscripten/third_party/ply/test/yacc_badtok.py +68 -0
- data/modules/emscripten/third_party/ply/test/yacc_dup.py +68 -0
- data/modules/emscripten/third_party/ply/test/yacc_error1.py +68 -0
- data/modules/emscripten/third_party/ply/test/yacc_error2.py +68 -0
- data/modules/emscripten/third_party/ply/test/yacc_error3.py +67 -0
- data/modules/emscripten/third_party/ply/test/yacc_error4.py +72 -0
- data/modules/emscripten/third_party/ply/test/yacc_inf.py +56 -0
- data/modules/emscripten/third_party/ply/test/yacc_literal.py +69 -0
- data/modules/emscripten/third_party/ply/test/yacc_misplaced.py +68 -0
- data/modules/emscripten/third_party/ply/test/yacc_missing1.py +68 -0
- data/modules/emscripten/third_party/ply/test/yacc_nested.py +33 -0
- data/modules/emscripten/third_party/ply/test/yacc_nodoc.py +67 -0
- data/modules/emscripten/third_party/ply/test/yacc_noerror.py +66 -0
- data/modules/emscripten/third_party/ply/test/yacc_nop.py +68 -0
- data/modules/emscripten/third_party/ply/test/yacc_notfunc.py +66 -0
- data/modules/emscripten/third_party/ply/test/yacc_notok.py +67 -0
- data/modules/emscripten/third_party/ply/test/yacc_prec1.py +68 -0
- data/modules/emscripten/third_party/ply/test/yacc_rr.py +72 -0
- data/modules/emscripten/third_party/ply/test/yacc_rr_unused.py +30 -0
- data/modules/emscripten/third_party/ply/test/yacc_simple.py +68 -0
- data/modules/emscripten/third_party/ply/test/yacc_sr.py +63 -0
- data/modules/emscripten/third_party/ply/test/yacc_term1.py +68 -0
- data/modules/emscripten/third_party/ply/test/yacc_unused.py +77 -0
- data/modules/emscripten/third_party/ply/test/yacc_unused_rule.py +72 -0
- data/modules/emscripten/third_party/ply/test/yacc_uprec.py +63 -0
- data/modules/emscripten/third_party/ply/test/yacc_uprec2.py +63 -0
- data/modules/emscripten/third_party/readme.txt +7 -0
- data/modules/emscripten/third_party/websockify/CHANGES.txt +23 -0
- data/modules/emscripten/third_party/websockify/LICENSE.txt +16 -0
- data/modules/emscripten/third_party/websockify/MANIFEST.in +1 -0
- data/modules/emscripten/third_party/websockify/Makefile +11 -0
- data/modules/emscripten/third_party/websockify/README.md +168 -0
- data/modules/emscripten/third_party/websockify/Windows/Windows Service Readme.txt +39 -0
- data/modules/emscripten/third_party/websockify/Windows/noVNC Websocket Service Project/Program.cs +24 -0
- data/modules/emscripten/third_party/websockify/Windows/noVNC Websocket Service Project/ProjectInstaller.Designer.cs +61 -0
- data/modules/emscripten/third_party/websockify/Windows/noVNC Websocket Service Project/ProjectInstaller.cs +19 -0
- data/modules/emscripten/third_party/websockify/Windows/noVNC Websocket Service Project/ProjectInstaller.resx +129 -0
- data/modules/emscripten/third_party/websockify/Windows/noVNC Websocket Service Project/Properties/AssemblyInfo.cs +36 -0
- data/modules/emscripten/third_party/websockify/Windows/noVNC Websocket Service Project/Service1.Designer.cs +37 -0
- data/modules/emscripten/third_party/websockify/Windows/noVNC Websocket Service Project/Service1.cs +41 -0
- data/modules/emscripten/third_party/websockify/Windows/noVNC Websocket Service Project/noVNC Websocket.csproj +75 -0
- data/modules/emscripten/third_party/websockify/Windows/noVNC Websocket Service Project/noVNC Websocket.sln +20 -0
- data/modules/emscripten/third_party/websockify/docs/LICENSE.GPL-3 +621 -0
- data/modules/emscripten/third_party/websockify/docs/LICENSE.LGPL-3 +165 -0
- data/modules/emscripten/third_party/websockify/docs/LICENSE.MPL-2.0 +373 -0
- data/modules/emscripten/third_party/websockify/docs/TODO +9 -0
- data/modules/emscripten/third_party/websockify/docs/flash_policy.txt +4 -0
- data/modules/emscripten/third_party/websockify/docs/latency_results.txt +114 -0
- data/modules/emscripten/third_party/websockify/docs/notes +17 -0
- data/modules/emscripten/third_party/websockify/docs/release.txt +9 -0
- data/modules/emscripten/third_party/websockify/docs/websockify.1 +110 -0
- data/modules/emscripten/third_party/websockify/include/VT100.js +919 -0
- data/modules/emscripten/third_party/websockify/include/base64.js +114 -0
- data/modules/emscripten/third_party/websockify/include/keysym.js +99 -0
- data/modules/emscripten/third_party/websockify/include/util.js +359 -0
- data/modules/emscripten/third_party/websockify/include/web-socket-js/README.txt +109 -0
- data/modules/emscripten/third_party/websockify/include/web-socket-js/WebSocketMain.swf +0 -0
- data/modules/emscripten/third_party/websockify/include/web-socket-js/swfobject.js +4 -0
- data/modules/emscripten/third_party/websockify/include/web-socket-js/web_socket.js +391 -0
- data/modules/emscripten/third_party/websockify/include/websock.js +422 -0
- data/modules/emscripten/third_party/websockify/include/webutil.js +216 -0
- data/modules/emscripten/third_party/websockify/include/wsirc.js +235 -0
- data/modules/emscripten/third_party/websockify/include/wstelnet.js +335 -0
- data/modules/emscripten/third_party/websockify/other/Makefile +14 -0
- data/modules/emscripten/third_party/websockify/other/README.md +51 -0
- data/modules/emscripten/third_party/websockify/other/launch.sh +108 -0
- data/modules/emscripten/third_party/websockify/other/project.clj +13 -0
- data/modules/emscripten/third_party/websockify/other/websocket.c +802 -0
- data/modules/emscripten/third_party/websockify/other/websocket.h +84 -0
- data/modules/emscripten/third_party/websockify/other/websocket.rb +456 -0
- data/modules/emscripten/third_party/websockify/other/websockify.c +385 -0
- data/modules/emscripten/third_party/websockify/other/websockify.clj +233 -0
- data/modules/emscripten/third_party/websockify/other/websockify.js +196 -0
- data/modules/emscripten/third_party/websockify/other/websockify.rb +171 -0
- data/modules/emscripten/third_party/websockify/other/wswrap +22 -0
- data/modules/emscripten/third_party/websockify/rebind +18 -0
- data/modules/emscripten/third_party/websockify/rebind.c +94 -0
- data/modules/emscripten/third_party/websockify/run +5 -0
- data/modules/emscripten/third_party/websockify/setup.py +30 -0
- data/modules/emscripten/third_party/websockify/tests/b64_vs_utf8.py +29 -0
- data/modules/emscripten/third_party/websockify/tests/base64.html +91 -0
- data/modules/emscripten/third_party/websockify/tests/base64.js +12 -0
- data/modules/emscripten/third_party/websockify/tests/echo.html +148 -0
- data/modules/emscripten/third_party/websockify/tests/echo.py +75 -0
- data/modules/emscripten/third_party/websockify/tests/echo.rb +62 -0
- data/modules/emscripten/third_party/websockify/tests/latency.html +290 -0
- data/modules/emscripten/third_party/websockify/tests/latency.py +75 -0
- data/modules/emscripten/third_party/websockify/tests/load.html +250 -0
- data/modules/emscripten/third_party/websockify/tests/load.py +167 -0
- data/modules/emscripten/third_party/websockify/tests/plain_echo.html +168 -0
- data/modules/emscripten/third_party/websockify/tests/simple.html +68 -0
- data/modules/emscripten/third_party/websockify/tests/utf8-list.py +22 -0
- data/modules/emscripten/third_party/websockify/websockify/__init__.py +2 -0
- data/modules/emscripten/third_party/websockify/websockify/websocket.py +982 -0
- data/modules/emscripten/third_party/websockify/websockify/websocketproxy.py +393 -0
- data/modules/emscripten/third_party/websockify/websockify.py +5 -0
- data/modules/emscripten/third_party/websockify/wsirc.html +99 -0
- data/modules/emscripten/third_party/websockify/wstelnet.html +74 -0
- data/modules/emscripten/tools/__init__.py +0 -0
- data/modules/emscripten/tools/__init__.pyc +0 -0
- data/modules/emscripten/tools/autodebugger.py +289 -0
- data/modules/emscripten/tools/autodebugger_c.py +37 -0
- data/modules/emscripten/tools/autodebugger_indenter.py +18 -0
- data/modules/emscripten/tools/autodebugger_js.py +47 -0
- data/modules/emscripten/tools/autodediffer.py +60 -0
- data/modules/emscripten/tools/bindings_generator.py +832 -0
- data/modules/emscripten/tools/bisect_pair.py +88 -0
- data/modules/emscripten/tools/cache.py +198 -0
- data/modules/emscripten/tools/cache.pyc +0 -0
- data/modules/emscripten/tools/clean_webconsole.py +34 -0
- data/modules/emscripten/tools/crunch-worker.js +124 -0
- data/modules/emscripten/tools/diff_autodebugger.py +15 -0
- data/modules/emscripten/tools/eliminator/asm-eliminator-test-output.js +5129 -0
- data/modules/emscripten/tools/eliminator/asm-eliminator-test.js +6861 -0
- data/modules/emscripten/tools/eliminator/eliminator-test-output.js +6122 -0
- data/modules/emscripten/tools/eliminator/eliminator-test.js +8856 -0
- data/modules/emscripten/tools/eliminator/node_modules/uglify-js/README.html +888 -0
- data/modules/emscripten/tools/eliminator/node_modules/uglify-js/README.org +463 -0
- data/modules/emscripten/tools/eliminator/node_modules/uglify-js/bin/uglifyjs +317 -0
- data/modules/emscripten/tools/eliminator/node_modules/uglify-js/docstyle.css +75 -0
- data/modules/emscripten/tools/eliminator/node_modules/uglify-js/lib/object-ast.js +75 -0
- data/modules/emscripten/tools/eliminator/node_modules/uglify-js/lib/parse-js.js +1363 -0
- data/modules/emscripten/tools/eliminator/node_modules/uglify-js/lib/process.js +2005 -0
- data/modules/emscripten/tools/eliminator/node_modules/uglify-js/lib/squeeze-more.js +51 -0
- data/modules/emscripten/tools/eliminator/node_modules/uglify-js/package.json +22 -0
- data/modules/emscripten/tools/eliminator/node_modules/uglify-js/test/beautify.js +28 -0
- data/modules/emscripten/tools/eliminator/node_modules/uglify-js/test/testparser.js +402 -0
- data/modules/emscripten/tools/eliminator/node_modules/uglify-js/test/unit/compress/expected/array1.js +1 -0
- data/modules/emscripten/tools/eliminator/node_modules/uglify-js/test/unit/compress/expected/array2.js +1 -0
- data/modules/emscripten/tools/eliminator/node_modules/uglify-js/test/unit/compress/expected/array3.js +1 -0
- data/modules/emscripten/tools/eliminator/node_modules/uglify-js/test/unit/compress/expected/array4.js +1 -0
- data/modules/emscripten/tools/eliminator/node_modules/uglify-js/test/unit/compress/expected/assignment.js +1 -0
- data/modules/emscripten/tools/eliminator/node_modules/uglify-js/test/unit/compress/expected/concatstring.js +1 -0
- data/modules/emscripten/tools/eliminator/node_modules/uglify-js/test/unit/compress/expected/const.js +1 -0
- data/modules/emscripten/tools/eliminator/node_modules/uglify-js/test/unit/compress/expected/empty-blocks.js +1 -0
- data/modules/emscripten/tools/eliminator/node_modules/uglify-js/test/unit/compress/expected/forstatement.js +1 -0
- data/modules/emscripten/tools/eliminator/node_modules/uglify-js/test/unit/compress/expected/if.js +1 -0
- data/modules/emscripten/tools/eliminator/node_modules/uglify-js/test/unit/compress/expected/ifreturn.js +1 -0
- data/modules/emscripten/tools/eliminator/node_modules/uglify-js/test/unit/compress/expected/ifreturn2.js +1 -0
- data/modules/emscripten/tools/eliminator/node_modules/uglify-js/test/unit/compress/expected/issue10.js +1 -0
- data/modules/emscripten/tools/eliminator/node_modules/uglify-js/test/unit/compress/expected/issue11.js +1 -0
- data/modules/emscripten/tools/eliminator/node_modules/uglify-js/test/unit/compress/expected/issue13.js +1 -0
- data/modules/emscripten/tools/eliminator/node_modules/uglify-js/test/unit/compress/expected/issue14.js +1 -0
- data/modules/emscripten/tools/eliminator/node_modules/uglify-js/test/unit/compress/expected/issue16.js +1 -0
- data/modules/emscripten/tools/eliminator/node_modules/uglify-js/test/unit/compress/expected/issue17.js +1 -0
- data/modules/emscripten/tools/eliminator/node_modules/uglify-js/test/unit/compress/expected/issue20.js +1 -0
- data/modules/emscripten/tools/eliminator/node_modules/uglify-js/test/unit/compress/expected/issue21.js +1 -0
- data/modules/emscripten/tools/eliminator/node_modules/uglify-js/test/unit/compress/expected/issue25.js +1 -0
- data/modules/emscripten/tools/eliminator/node_modules/uglify-js/test/unit/compress/expected/issue27.js +1 -0
- data/modules/emscripten/tools/eliminator/node_modules/uglify-js/test/unit/compress/expected/issue28.js +1 -0
- data/modules/emscripten/tools/eliminator/node_modules/uglify-js/test/unit/compress/expected/issue29.js +1 -0
- data/modules/emscripten/tools/eliminator/node_modules/uglify-js/test/unit/compress/expected/issue30.js +1 -0
- data/modules/emscripten/tools/eliminator/node_modules/uglify-js/test/unit/compress/expected/issue34.js +1 -0
- data/modules/emscripten/tools/eliminator/node_modules/uglify-js/test/unit/compress/expected/issue4.js +1 -0
- data/modules/emscripten/tools/eliminator/node_modules/uglify-js/test/unit/compress/expected/issue48.js +1 -0
- data/modules/emscripten/tools/eliminator/node_modules/uglify-js/test/unit/compress/expected/issue50.js +1 -0
- data/modules/emscripten/tools/eliminator/node_modules/uglify-js/test/unit/compress/expected/issue53.js +1 -0
- data/modules/emscripten/tools/eliminator/node_modules/uglify-js/test/unit/compress/expected/issue54.1.js +1 -0
- data/modules/emscripten/tools/eliminator/node_modules/uglify-js/test/unit/compress/expected/issue68.js +1 -0
- data/modules/emscripten/tools/eliminator/node_modules/uglify-js/test/unit/compress/expected/issue69.js +1 -0
- data/modules/emscripten/tools/eliminator/node_modules/uglify-js/test/unit/compress/expected/issue9.js +1 -0
- data/modules/emscripten/tools/eliminator/node_modules/uglify-js/test/unit/compress/expected/mangle.js +1 -0
- data/modules/emscripten/tools/eliminator/node_modules/uglify-js/test/unit/compress/expected/strict-equals.js +1 -0
- data/modules/emscripten/tools/eliminator/node_modules/uglify-js/test/unit/compress/expected/var.js +1 -0
- data/modules/emscripten/tools/eliminator/node_modules/uglify-js/test/unit/compress/expected/with.js +1 -0
- data/modules/emscripten/tools/eliminator/node_modules/uglify-js/test/unit/compress/test/array1.js +3 -0
- data/modules/emscripten/tools/eliminator/node_modules/uglify-js/test/unit/compress/test/array2.js +4 -0
- data/modules/emscripten/tools/eliminator/node_modules/uglify-js/test/unit/compress/test/array3.js +4 -0
- data/modules/emscripten/tools/eliminator/node_modules/uglify-js/test/unit/compress/test/array4.js +6 -0
- data/modules/emscripten/tools/eliminator/node_modules/uglify-js/test/unit/compress/test/assignment.js +20 -0
- data/modules/emscripten/tools/eliminator/node_modules/uglify-js/test/unit/compress/test/concatstring.js +3 -0
- data/modules/emscripten/tools/eliminator/node_modules/uglify-js/test/unit/compress/test/const.js +5 -0
- data/modules/emscripten/tools/eliminator/node_modules/uglify-js/test/unit/compress/test/empty-blocks.js +4 -0
- data/modules/emscripten/tools/eliminator/node_modules/uglify-js/test/unit/compress/test/forstatement.js +10 -0
- data/modules/emscripten/tools/eliminator/node_modules/uglify-js/test/unit/compress/test/if.js +6 -0
- data/modules/emscripten/tools/eliminator/node_modules/uglify-js/test/unit/compress/test/ifreturn.js +9 -0
- data/modules/emscripten/tools/eliminator/node_modules/uglify-js/test/unit/compress/test/ifreturn2.js +16 -0
- data/modules/emscripten/tools/eliminator/node_modules/uglify-js/test/unit/compress/test/issue10.js +1 -0
- data/modules/emscripten/tools/eliminator/node_modules/uglify-js/test/unit/compress/test/issue11.js +3 -0
- data/modules/emscripten/tools/eliminator/node_modules/uglify-js/test/unit/compress/test/issue13.js +1 -0
- data/modules/emscripten/tools/eliminator/node_modules/uglify-js/test/unit/compress/test/issue14.js +1 -0
- data/modules/emscripten/tools/eliminator/node_modules/uglify-js/test/unit/compress/test/issue16.js +1 -0
- data/modules/emscripten/tools/eliminator/node_modules/uglify-js/test/unit/compress/test/issue17.js +4 -0
- data/modules/emscripten/tools/eliminator/node_modules/uglify-js/test/unit/compress/test/issue20.js +1 -0
- data/modules/emscripten/tools/eliminator/node_modules/uglify-js/test/unit/compress/test/issue21.js +6 -0
- data/modules/emscripten/tools/eliminator/node_modules/uglify-js/test/unit/compress/test/issue25.js +7 -0
- data/modules/emscripten/tools/eliminator/node_modules/uglify-js/test/unit/compress/test/issue27.js +1 -0
- data/modules/emscripten/tools/eliminator/node_modules/uglify-js/test/unit/compress/test/issue28.js +3 -0
- data/modules/emscripten/tools/eliminator/node_modules/uglify-js/test/unit/compress/test/issue29.js +1 -0
- data/modules/emscripten/tools/eliminator/node_modules/uglify-js/test/unit/compress/test/issue30.js +3 -0
- data/modules/emscripten/tools/eliminator/node_modules/uglify-js/test/unit/compress/test/issue34.js +3 -0
- data/modules/emscripten/tools/eliminator/node_modules/uglify-js/test/unit/compress/test/issue4.js +3 -0
- data/modules/emscripten/tools/eliminator/node_modules/uglify-js/test/unit/compress/test/issue48.js +1 -0
- data/modules/emscripten/tools/eliminator/node_modules/uglify-js/test/unit/compress/test/issue50.js +9 -0
- data/modules/emscripten/tools/eliminator/node_modules/uglify-js/test/unit/compress/test/issue53.js +1 -0
- data/modules/emscripten/tools/eliminator/node_modules/uglify-js/test/unit/compress/test/issue54.1.js +3 -0
- data/modules/emscripten/tools/eliminator/node_modules/uglify-js/test/unit/compress/test/issue68.js +5 -0
- data/modules/emscripten/tools/eliminator/node_modules/uglify-js/test/unit/compress/test/issue69.js +1 -0
- data/modules/emscripten/tools/eliminator/node_modules/uglify-js/test/unit/compress/test/issue9.js +4 -0
- data/modules/emscripten/tools/eliminator/node_modules/uglify-js/test/unit/compress/test/mangle.js +5 -0
- data/modules/emscripten/tools/eliminator/node_modules/uglify-js/test/unit/compress/test/strict-equals.js +3 -0
- data/modules/emscripten/tools/eliminator/node_modules/uglify-js/test/unit/compress/test/var.js +3 -0
- data/modules/emscripten/tools/eliminator/node_modules/uglify-js/test/unit/compress/test/with.js +2 -0
- data/modules/emscripten/tools/eliminator/node_modules/uglify-js/test/unit/scripts.js +55 -0
- data/modules/emscripten/tools/eliminator/node_modules/uglify-js/tmp/hoist.js +33 -0
- data/modules/emscripten/tools/eliminator/node_modules/uglify-js/tmp/instrument.js +97 -0
- data/modules/emscripten/tools/eliminator/node_modules/uglify-js/tmp/instrument2.js +138 -0
- data/modules/emscripten/tools/eliminator/node_modules/uglify-js/tmp/test.js +16 -0
- data/modules/emscripten/tools/eliminator/node_modules/uglify-js/uglify-js.js +17 -0
- data/modules/emscripten/tools/eliminator/safe-eliminator-test-output.js +85 -0
- data/modules/emscripten/tools/eliminator/safe-eliminator-test.js +103 -0
- data/modules/emscripten/tools/emconfiguren.py +19 -0
- data/modules/emscripten/tools/emmaken.py +230 -0
- data/modules/emscripten/tools/emmakenxx.py +18 -0
- data/modules/emscripten/tools/exec_llvm.py +50 -0
- data/modules/emscripten/tools/file2json.py +49 -0
- data/modules/emscripten/tools/file_packager.py +649 -0
- data/modules/emscripten/tools/find_bigfuncs.py +23 -0
- data/modules/emscripten/tools/find_bigis.py +18 -0
- data/modules/emscripten/tools/fix_closure.py +88 -0
- data/modules/emscripten/tools/ie7_fix.py +14 -0
- data/modules/emscripten/tools/js-optimizer.js +3440 -0
- data/modules/emscripten/tools/js_optimizer.py +341 -0
- data/modules/emscripten/tools/js_optimizer.pyc +0 -0
- data/modules/emscripten/tools/jsrun.py +27 -0
- data/modules/emscripten/tools/jsrun.pyc +0 -0
- data/modules/emscripten/tools/ll-strip.py +56 -0
- data/modules/emscripten/tools/make_file.py +19 -0
- data/modules/emscripten/tools/make_minigzip.py +13 -0
- data/modules/emscripten/tools/namespacer.py +95 -0
- data/modules/emscripten/tools/nativize_llvm.py +34 -0
- data/modules/emscripten/tools/node_modules/source-map/CHANGELOG.md +58 -0
- data/modules/emscripten/tools/node_modules/source-map/LICENSE +28 -0
- data/modules/emscripten/tools/node_modules/source-map/Makefile.dryice.js +166 -0
- data/modules/emscripten/tools/node_modules/source-map/README.md +347 -0
- data/modules/emscripten/tools/node_modules/source-map/build/assert-shim.js +56 -0
- data/modules/emscripten/tools/node_modules/source-map/build/mini-require.js +152 -0
- data/modules/emscripten/tools/node_modules/source-map/build/prefix-source-map.jsm +20 -0
- data/modules/emscripten/tools/node_modules/source-map/build/prefix-utils.jsm +18 -0
- data/modules/emscripten/tools/node_modules/source-map/build/suffix-browser.js +8 -0
- data/modules/emscripten/tools/node_modules/source-map/build/suffix-source-map.jsm +6 -0
- data/modules/emscripten/tools/node_modules/source-map/build/suffix-utils.jsm +21 -0
- data/modules/emscripten/tools/node_modules/source-map/build/test-prefix.js +8 -0
- data/modules/emscripten/tools/node_modules/source-map/build/test-suffix.js +3 -0
- data/modules/emscripten/tools/node_modules/source-map/lib/source-map/array-set.js +96 -0
- data/modules/emscripten/tools/node_modules/source-map/lib/source-map/base64-vlq.js +144 -0
- data/modules/emscripten/tools/node_modules/source-map/lib/source-map/base64.js +42 -0
- data/modules/emscripten/tools/node_modules/source-map/lib/source-map/binary-search.js +81 -0
- data/modules/emscripten/tools/node_modules/source-map/lib/source-map/source-map-consumer.js +430 -0
- data/modules/emscripten/tools/node_modules/source-map/lib/source-map/source-map-generator.js +381 -0
- data/modules/emscripten/tools/node_modules/source-map/lib/source-map/source-node.js +353 -0
- data/modules/emscripten/tools/node_modules/source-map/lib/source-map/util.js +117 -0
- data/modules/emscripten/tools/node_modules/source-map/lib/source-map.js +8 -0
- data/modules/emscripten/tools/node_modules/source-map/node_modules/amdefine/LICENSE +58 -0
- data/modules/emscripten/tools/node_modules/source-map/node_modules/amdefine/README.md +119 -0
- data/modules/emscripten/tools/node_modules/source-map/node_modules/amdefine/amdefine.js +299 -0
- data/modules/emscripten/tools/node_modules/source-map/node_modules/amdefine/package.json +33 -0
- data/modules/emscripten/tools/node_modules/source-map/package.json +74 -0
- data/modules/emscripten/tools/node_modules/source-map/test/run-tests.js +73 -0
- data/modules/emscripten/tools/node_modules/source-map/test/source-map/test-api.js +26 -0
- data/modules/emscripten/tools/node_modules/source-map/test/source-map/test-array-set.js +71 -0
- data/modules/emscripten/tools/node_modules/source-map/test/source-map/test-base64-vlq.js +24 -0
- data/modules/emscripten/tools/node_modules/source-map/test/source-map/test-base64.js +35 -0
- data/modules/emscripten/tools/node_modules/source-map/test/source-map/test-binary-search.js +54 -0
- data/modules/emscripten/tools/node_modules/source-map/test/source-map/test-dog-fooding.js +72 -0
- data/modules/emscripten/tools/node_modules/source-map/test/source-map/test-source-map-consumer.js +306 -0
- data/modules/emscripten/tools/node_modules/source-map/test/source-map/test-source-map-generator.js +391 -0
- data/modules/emscripten/tools/node_modules/source-map/test/source-map/test-source-node.js +282 -0
- data/modules/emscripten/tools/node_modules/source-map/test/source-map/util.js +152 -0
- data/modules/emscripten/tools/reproduceriter.js +216 -0
- data/modules/emscripten/tools/reproduceriter.py +160 -0
- data/modules/emscripten/tools/response_file.py +28 -0
- data/modules/emscripten/tools/response_file.pyc +0 -0
- data/modules/emscripten/tools/scan_js.py +20 -0
- data/modules/emscripten/tools/scan_ll.py +18 -0
- data/modules/emscripten/tools/scons/site_scons/site_tools/emscripten/__init__.py +3 -0
- data/modules/emscripten/tools/scons/site_scons/site_tools/emscripten/emscripten.py +46 -0
- data/modules/emscripten/tools/settings_template_readonly.py +47 -0
- data/modules/emscripten/tools/shared.py +1437 -0
- data/modules/emscripten/tools/shared.pyc +0 -0
- data/modules/emscripten/tools/source-maps/sourcemap2json.js +15 -0
- data/modules/emscripten/tools/source-maps/sourcemapper.js +177 -0
- data/modules/emscripten/tools/split.py +97 -0
- data/modules/emscripten/tools/tempfiles.py +40 -0
- data/modules/emscripten/tools/tempfiles.pyc +0 -0
- data/modules/emscripten/tools/test-js-optimizer-asm-last-output.js +75 -0
- data/modules/emscripten/tools/test-js-optimizer-asm-last.js +91 -0
- data/modules/emscripten/tools/test-js-optimizer-asm-outline-output.js +570 -0
- data/modules/emscripten/tools/test-js-optimizer-asm-outline.js +606 -0
- data/modules/emscripten/tools/test-js-optimizer-asm-pre-output.js +540 -0
- data/modules/emscripten/tools/test-js-optimizer-asm-pre.js +550 -0
- data/modules/emscripten/tools/test-js-optimizer-asm-regs-min-output.js +36 -0
- data/modules/emscripten/tools/test-js-optimizer-asm-regs-min.js +37 -0
- data/modules/emscripten/tools/test-js-optimizer-asm-regs-output.js +106 -0
- data/modules/emscripten/tools/test-js-optimizer-asm-regs.js +110 -0
- data/modules/emscripten/tools/test-js-optimizer-asm-relocate-output.js +9 -0
- data/modules/emscripten/tools/test-js-optimizer-asm-relocate.js +12 -0
- data/modules/emscripten/tools/test-js-optimizer-output.js +291 -0
- data/modules/emscripten/tools/test-js-optimizer-regs-output.js +232 -0
- data/modules/emscripten/tools/test-js-optimizer-regs.js +237 -0
- data/modules/emscripten/tools/test-js-optimizer-t2-output.js +91 -0
- data/modules/emscripten/tools/test-js-optimizer-t2.js +92 -0
- data/modules/emscripten/tools/test-js-optimizer-t2c-output.js +17 -0
- data/modules/emscripten/tools/test-js-optimizer-t2c.js +18 -0
- data/modules/emscripten/tools/test-js-optimizer-t3-output.js +49 -0
- data/modules/emscripten/tools/test-js-optimizer-t3.js +50 -0
- data/modules/emscripten/tools/test-js-optimizer.js +401 -0
- data/modules/mruby/AUTHORS +18 -0
- data/modules/mruby/CONTRIBUTING.md +65 -0
- data/modules/mruby/ChangeLog +15 -0
- data/modules/mruby/INSTALL +29 -0
- data/modules/mruby/LEGAL +6 -0
- data/modules/mruby/MITL +20 -0
- data/modules/mruby/Makefile +18 -0
- data/modules/mruby/NEWS +13 -0
- data/modules/mruby/README.md +116 -0
- data/modules/mruby/Rakefile +114 -0
- data/modules/mruby/TODO +11 -0
- data/modules/mruby/benchmark/ao-render.rb +315 -0
- data/modules/mruby/benchmark/bm_so_lists.rb +47 -0
- data/modules/mruby/benchmark/fib39.rb +8 -0
- data/modules/mruby/build_config.rb +88 -0
- data/modules/mruby/doc/compile/README.md +376 -0
- data/modules/mruby/doc/mrbgems/README.md +254 -0
- data/modules/mruby/examples/mrbgems/c_and_ruby_extension_example/README.md +4 -0
- data/modules/mruby/examples/mrbgems/c_and_ruby_extension_example/mrbgem.rake +23 -0
- data/modules/mruby/examples/mrbgems/c_and_ruby_extension_example/mrblib/example.rb +5 -0
- data/modules/mruby/examples/mrbgems/c_and_ruby_extension_example/src/example.c +20 -0
- data/modules/mruby/examples/mrbgems/c_and_ruby_extension_example/test/example.rb +7 -0
- data/modules/mruby/examples/mrbgems/c_extension_example/README.md +4 -0
- data/modules/mruby/examples/mrbgems/c_extension_example/mrbgem.rake +23 -0
- data/modules/mruby/examples/mrbgems/c_extension_example/src/example.c +20 -0
- data/modules/mruby/examples/mrbgems/c_extension_example/test/example.c +7 -0
- data/modules/mruby/examples/mrbgems/c_extension_example/test/example.rb +3 -0
- data/modules/mruby/examples/mrbgems/ruby_extension_example/README.md +4 -0
- data/modules/mruby/examples/mrbgems/ruby_extension_example/mrbgem.rake +23 -0
- data/modules/mruby/examples/mrbgems/ruby_extension_example/mrblib/example.rb +5 -0
- data/modules/mruby/examples/mrbgems/ruby_extension_example/test/example.rb +3 -0
- data/modules/mruby/examples/targets/ArduinoDue.rb +65 -0
- data/modules/mruby/examples/targets/chipKitMax32.rb +68 -0
- data/modules/mruby/include/mrbconf.h +87 -0
- data/modules/mruby/include/mruby/array.h +63 -0
- data/modules/mruby/include/mruby/class.h +75 -0
- data/modules/mruby/include/mruby/compile.h +176 -0
- data/modules/mruby/include/mruby/data.h +53 -0
- data/modules/mruby/include/mruby/dump.h +151 -0
- data/modules/mruby/include/mruby/gc.h +17 -0
- data/modules/mruby/include/mruby/hash.h +54 -0
- data/modules/mruby/include/mruby/irep.h +40 -0
- data/modules/mruby/include/mruby/khash.h +257 -0
- data/modules/mruby/include/mruby/numeric.h +32 -0
- data/modules/mruby/include/mruby/proc.h +62 -0
- data/modules/mruby/include/mruby/range.h +35 -0
- data/modules/mruby/include/mruby/string.h +78 -0
- data/modules/mruby/include/mruby/value.h +483 -0
- data/modules/mruby/include/mruby/variable.h +78 -0
- data/modules/mruby/include/mruby.h +388 -0
- data/modules/mruby/minirake +477 -0
- data/modules/mruby/mrbgems/default.gembox +61 -0
- data/modules/mruby/mrbgems/full-core.gembox +9 -0
- data/modules/mruby/mrbgems/mruby-array-ext/mrbgem.rake +4 -0
- data/modules/mruby/mrbgems/mruby-array-ext/mrblib/array.rb +204 -0
- data/modules/mruby/mrbgems/mruby-array-ext/src/array.c +140 -0
- data/modules/mruby/mrbgems/mruby-array-ext/test/array.rb +109 -0
- data/modules/mruby/mrbgems/mruby-bin-mirb/mrbgem.rake +5 -0
- data/modules/mruby/mrbgems/mruby-bin-mirb/tools/mirb/mirb.c +365 -0
- data/modules/mruby/mrbgems/mruby-bin-mruby/mrbgem.rake +5 -0
- data/modules/mruby/mrbgems/mruby-bin-mruby/tools/mruby/mruby.c +243 -0
- data/modules/mruby/mrbgems/mruby-enum-ext/mrbgem.rake +4 -0
- data/modules/mruby/mrbgems/mruby-enum-ext/mrblib/enum.rb +164 -0
- data/modules/mruby/mrbgems/mruby-enum-ext/test/enum.rb +44 -0
- data/modules/mruby/mrbgems/mruby-eval/mrbgem.rake +4 -0
- data/modules/mruby/mrbgems/mruby-eval/src/eval.c +23 -0
- data/modules/mruby/mrbgems/mruby-fiber/mrbgem.rake +4 -0
- data/modules/mruby/mrbgems/mruby-fiber/src/fiber.c +251 -0
- data/modules/mruby/mrbgems/mruby-fiber/test/fiber.rb +64 -0
- data/modules/mruby/mrbgems/mruby-hash-ext/mrbgem.rake +4 -0
- data/modules/mruby/mrbgems/mruby-hash-ext/mrblib/hash.rb +13 -0
- data/modules/mruby/mrbgems/mruby-hash-ext/src/hash-ext.c +62 -0
- data/modules/mruby/mrbgems/mruby-hash-ext/test/hash.rb +26 -0
- data/modules/mruby/mrbgems/mruby-math/mrbgem.rake +4 -0
- data/modules/mruby/mrbgems/mruby-math/src/math.c +685 -0
- data/modules/mruby/mrbgems/mruby-math/test/math.rb +136 -0
- data/modules/mruby/mrbgems/mruby-numeric-ext/mrbgem.rake +4 -0
- data/modules/mruby/mrbgems/mruby-numeric-ext/src/numeric_ext.c +31 -0
- data/modules/mruby/mrbgems/mruby-numeric-ext/test/numeric.rb +10 -0
- data/modules/mruby/mrbgems/mruby-object-ext/mrbgem.rake +4 -0
- data/modules/mruby/mrbgems/mruby-object-ext/src/object.c +108 -0
- data/modules/mruby/mrbgems/mruby-object-ext/test/nil.rb +11 -0
- data/modules/mruby/mrbgems/mruby-object-ext/test/object.rb +9 -0
- data/modules/mruby/mrbgems/mruby-objectspace/mrbgem.rake +4 -0
- data/modules/mruby/mrbgems/mruby-objectspace/src/mruby_objectspace.c +117 -0
- data/modules/mruby/mrbgems/mruby-objectspace/test/objectspace.rb +38 -0
- data/modules/mruby/mrbgems/mruby-print/mrbgem.rake +4 -0
- data/modules/mruby/mrbgems/mruby-print/mrblib/print.rb +64 -0
- data/modules/mruby/mrbgems/mruby-print/src/print.c +44 -0
- data/modules/mruby/mrbgems/mruby-proc-ext/mrbgem.rake +4 -0
- data/modules/mruby/mrbgems/mruby-proc-ext/mrblib/proc.rb +40 -0
- data/modules/mruby/mrbgems/mruby-proc-ext/src/proc.c +97 -0
- data/modules/mruby/mrbgems/mruby-proc-ext/test/proc.rb +41 -0
- data/modules/mruby/mrbgems/mruby-random/mrbgem.rake +4 -0
- data/modules/mruby/mrbgems/mruby-random/src/mt19937ar.c +193 -0
- data/modules/mruby/mrbgems/mruby-random/src/mt19937ar.h +48 -0
- data/modules/mruby/mrbgems/mruby-random/src/random.c +231 -0
- data/modules/mruby/mrbgems/mruby-random/src/random.h +12 -0
- data/modules/mruby/mrbgems/mruby-random/test/random.rb +32 -0
- data/modules/mruby/mrbgems/mruby-range-ext/mrbgem.rake +4 -0
- data/modules/mruby/mrbgems/mruby-range-ext/src/range.c +141 -0
- data/modules/mruby/mrbgems/mruby-range-ext/test/range.rb +20 -0
- data/modules/mruby/mrbgems/mruby-sprintf/mrbgem.rake +4 -0
- data/modules/mruby/mrbgems/mruby-sprintf/src/kernel.c +30 -0
- data/modules/mruby/mrbgems/mruby-sprintf/src/sprintf.c +1102 -0
- data/modules/mruby/mrbgems/mruby-sprintf/test/sprintf.rb +3 -0
- data/modules/mruby/mrbgems/mruby-string-ext/mrbgem.rake +4 -0
- data/modules/mruby/mrbgems/mruby-string-ext/mrblib/string.rb +52 -0
- data/modules/mruby/mrbgems/mruby-string-ext/src/string.c +175 -0
- data/modules/mruby/mrbgems/mruby-string-ext/test/string.rb +112 -0
- data/modules/mruby/mrbgems/mruby-struct/mrbgem.rake +4 -0
- data/modules/mruby/mrbgems/mruby-struct/mrblib/struct.rb +50 -0
- data/modules/mruby/mrbgems/mruby-struct/src/struct.c +818 -0
- data/modules/mruby/mrbgems/mruby-struct/test/struct.rb +77 -0
- data/modules/mruby/mrbgems/mruby-symbol-ext/mrbgem.rake +4 -0
- data/modules/mruby/mrbgems/mruby-symbol-ext/mrblib/symbol.rb +9 -0
- data/modules/mruby/mrbgems/mruby-symbol-ext/src/symbol.c +55 -0
- data/modules/mruby/mrbgems/mruby-symbol-ext/test/symbol.rb +12 -0
- data/modules/mruby/mrbgems/mruby-time/mrbgem.rake +4 -0
- data/modules/mruby/mrbgems/mruby-time/src/time.c +749 -0
- data/modules/mruby/mrbgems/mruby-time/test/time.rb +201 -0
- data/modules/mruby/mrbgems/mruby-toplevel-ext/mrbgem.rake +4 -0
- data/modules/mruby/mrbgems/mruby-toplevel-ext/mrblib/toplevel.rb +11 -0
- data/modules/mruby/mrbgems/mruby-toplevel-ext/test/toplevel.rb +24 -0
- data/modules/mruby/mrblib/array.rb +111 -0
- data/modules/mruby/mrblib/class.rb +26 -0
- data/modules/mruby/mrblib/compar.rb +104 -0
- data/modules/mruby/mrblib/enum.rb +398 -0
- data/modules/mruby/mrblib/error.rb +66 -0
- data/modules/mruby/mrblib/hash.rb +193 -0
- data/modules/mruby/mrblib/init_mrblib.c +14 -0
- data/modules/mruby/mrblib/kernel.rb +46 -0
- data/modules/mruby/mrblib/mrblib.rake +18 -0
- data/modules/mruby/mrblib/numeric.rb +101 -0
- data/modules/mruby/mrblib/print.rb +18 -0
- data/modules/mruby/mrblib/range.rb +40 -0
- data/modules/mruby/mrblib/string.rb +145 -0
- data/modules/mruby/src/array.c +1150 -0
- data/modules/mruby/src/backtrace.c +73 -0
- data/modules/mruby/src/class.c +1942 -0
- data/modules/mruby/src/codegen.c +2864 -0
- data/modules/mruby/src/compar.c +13 -0
- data/modules/mruby/src/crc.c +38 -0
- data/modules/mruby/src/dump.c +542 -0
- data/modules/mruby/src/enum.c +14 -0
- data/modules/mruby/src/error.c +454 -0
- data/modules/mruby/src/error.h +18 -0
- data/modules/mruby/src/etc.c +204 -0
- data/modules/mruby/src/gc.c +1542 -0
- data/modules/mruby/src/hash.c +1261 -0
- data/modules/mruby/src/init.c +62 -0
- data/modules/mruby/src/kernel.c +1105 -0
- data/modules/mruby/src/keywords +50 -0
- data/modules/mruby/src/lex.def +212 -0
- data/modules/mruby/src/load.c +629 -0
- data/modules/mruby/src/mruby_core.rake +28 -0
- data/modules/mruby/src/node.h +117 -0
- data/modules/mruby/src/numeric.c +1418 -0
- data/modules/mruby/src/object.c +593 -0
- data/modules/mruby/src/opcode.h +160 -0
- data/modules/mruby/src/parse.y +6050 -0
- data/modules/mruby/src/pool.c +190 -0
- data/modules/mruby/src/print.c +71 -0
- data/modules/mruby/src/proc.c +209 -0
- data/modules/mruby/src/range.c +442 -0
- data/modules/mruby/src/re.h +13 -0
- data/modules/mruby/src/state.c +200 -0
- data/modules/mruby/src/string.c +2580 -0
- data/modules/mruby/src/symbol.c +456 -0
- data/modules/mruby/src/value_array.h +27 -0
- data/modules/mruby/src/variable.c +1147 -0
- data/modules/mruby/src/vm.c +2129 -0
- data/modules/mruby/tasks/libmruby.rake +18 -0
- data/modules/mruby/tasks/mrbgem_spec.rake +297 -0
- data/modules/mruby/tasks/mrbgems.rake +85 -0
- data/modules/mruby/tasks/mrbgems_test.rake +88 -0
- data/modules/mruby/tasks/mruby_build.rake +211 -0
- data/modules/mruby/tasks/mruby_build_commands.rake +287 -0
- data/modules/mruby/tasks/mruby_build_gem.rake +67 -0
- data/modules/mruby/tasks/ruby_ext.rake +70 -0
- data/modules/mruby/tasks/toolchains/androideabi.rake +126 -0
- data/modules/mruby/tasks/toolchains/clang.rake +8 -0
- data/modules/mruby/tasks/toolchains/gcc.rake +21 -0
- data/modules/mruby/tasks/toolchains/vs2010.rake +3 -0
- data/modules/mruby/tasks/toolchains/vs2012.rake +44 -0
- data/modules/mruby/test/README.md +7 -0
- data/modules/mruby/test/assert.rb +238 -0
- data/modules/mruby/test/driver.c +118 -0
- data/modules/mruby/test/init_mrbtest.c +24 -0
- data/modules/mruby/test/mrbtest.rake +47 -0
- data/modules/mruby/test/report.rb +4 -0
- data/modules/mruby/test/t/argumenterror.rb +21 -0
- data/modules/mruby/test/t/array.rb +309 -0
- data/modules/mruby/test/t/basicobject.rb +11 -0
- data/modules/mruby/test/t/bs_block.rb +489 -0
- data/modules/mruby/test/t/bs_literal.rb +38 -0
- data/modules/mruby/test/t/class.rb +219 -0
- data/modules/mruby/test/t/comparable.rb +72 -0
- data/modules/mruby/test/t/enumerable.rb +108 -0
- data/modules/mruby/test/t/exception.rb +337 -0
- data/modules/mruby/test/t/false.rb +33 -0
- data/modules/mruby/test/t/float.rb +145 -0
- data/modules/mruby/test/t/gc.rb +45 -0
- data/modules/mruby/test/t/hash.rb +310 -0
- data/modules/mruby/test/t/indexerror.rb +10 -0
- data/modules/mruby/test/t/integer.rb +222 -0
- data/modules/mruby/test/t/kernel.rb +425 -0
- data/modules/mruby/test/t/literals.rb +287 -0
- data/modules/mruby/test/t/localjumperror.rb +13 -0
- data/modules/mruby/test/t/methods.rb +109 -0
- data/modules/mruby/test/t/module.rb +344 -0
- data/modules/mruby/test/t/nameerror.rb +32 -0
- data/modules/mruby/test/t/nil.rb +29 -0
- data/modules/mruby/test/t/nomethoderror.rb +13 -0
- data/modules/mruby/test/t/numeric.rb +29 -0
- data/modules/mruby/test/t/object.rb +11 -0
- data/modules/mruby/test/t/proc.rb +56 -0
- data/modules/mruby/test/t/range.rb +82 -0
- data/modules/mruby/test/t/rangeerror.rb +10 -0
- data/modules/mruby/test/t/regexperror.rb +4 -0
- data/modules/mruby/test/t/runtimeerror.rb +6 -0
- data/modules/mruby/test/t/standarderror.rb +10 -0
- data/modules/mruby/test/t/string.rb +483 -0
- data/modules/mruby/test/t/symbol.rb +27 -0
- data/modules/mruby/test/t/syntax.rb +67 -0
- data/modules/mruby/test/t/true.rb +33 -0
- data/modules/mruby/test/t/typeerror.rb +11 -0
- data/modules/mruby/tools/mrbc/mrbc.c +318 -0
- data/modules/mruby/tools/mrbc/mrbc.rake +14 -0
- data/modules/mruby/travis_config.rb +6 -0
- data/modules/mrubymix/LICENSE +21 -0
- data/modules/mrubymix/README.md +6 -0
- data/modules/mrubymix/bin/mrubymix +29 -0
- data/modules/mrubymix/lib/mrubymix.rb +93 -0
- data/modules/mrubymix/mrubymix.gemspec +13 -0
- data/scripts/gen_gems_config.rb +185 -0
- data/scripts/gen_post.rb +104 -0
- data/templates/minimal/Rakefile +36 -0
- data/templates/minimal/app/app.rb +3 -0
- metadata +1408 -0
@@ -0,0 +1,2505 @@
|
|
1
|
+
// -*- C++ -*-
|
2
|
+
//===--------------------------- future -----------------------------------===//
|
3
|
+
//
|
4
|
+
// The LLVM Compiler Infrastructure
|
5
|
+
//
|
6
|
+
// This file is dual licensed under the MIT and the University of Illinois Open
|
7
|
+
// Source Licenses. See LICENSE.TXT for details.
|
8
|
+
//
|
9
|
+
//===----------------------------------------------------------------------===//
|
10
|
+
|
11
|
+
#ifndef _LIBCPP_FUTURE
|
12
|
+
#define _LIBCPP_FUTURE
|
13
|
+
|
14
|
+
/*
|
15
|
+
future synopsis
|
16
|
+
|
17
|
+
namespace std
|
18
|
+
{
|
19
|
+
|
20
|
+
enum class future_errc
|
21
|
+
{
|
22
|
+
broken_promise,
|
23
|
+
future_already_retrieved,
|
24
|
+
promise_already_satisfied,
|
25
|
+
no_state
|
26
|
+
};
|
27
|
+
|
28
|
+
enum class launch
|
29
|
+
{
|
30
|
+
async = 1,
|
31
|
+
deferred = 2,
|
32
|
+
any = async | deferred
|
33
|
+
};
|
34
|
+
|
35
|
+
enum class future_status
|
36
|
+
{
|
37
|
+
ready,
|
38
|
+
timeout,
|
39
|
+
deferred
|
40
|
+
};
|
41
|
+
|
42
|
+
template <> struct is_error_code_enum<future_errc> : public true_type { };
|
43
|
+
error_code make_error_code(future_errc e) noexcept;
|
44
|
+
error_condition make_error_condition(future_errc e) noexcept;
|
45
|
+
|
46
|
+
const error_category& future_category() noexcept;
|
47
|
+
|
48
|
+
class future_error
|
49
|
+
: public logic_error
|
50
|
+
{
|
51
|
+
public:
|
52
|
+
future_error(error_code ec); // exposition only
|
53
|
+
|
54
|
+
const error_code& code() const noexcept;
|
55
|
+
const char* what() const noexcept;
|
56
|
+
};
|
57
|
+
|
58
|
+
template <class R>
|
59
|
+
class promise
|
60
|
+
{
|
61
|
+
public:
|
62
|
+
promise();
|
63
|
+
template <class Allocator>
|
64
|
+
promise(allocator_arg_t, const Allocator& a);
|
65
|
+
promise(promise&& rhs) noexcept;
|
66
|
+
promise(const promise& rhs) = delete;
|
67
|
+
~promise();
|
68
|
+
|
69
|
+
// assignment
|
70
|
+
promise& operator=(promise&& rhs) noexcept;
|
71
|
+
promise& operator=(const promise& rhs) = delete;
|
72
|
+
void swap(promise& other) noexcept;
|
73
|
+
|
74
|
+
// retrieving the result
|
75
|
+
future<R> get_future();
|
76
|
+
|
77
|
+
// setting the result
|
78
|
+
void set_value(const R& r);
|
79
|
+
void set_value(R&& r);
|
80
|
+
void set_exception(exception_ptr p);
|
81
|
+
|
82
|
+
// setting the result with deferred notification
|
83
|
+
void set_value_at_thread_exit(const R& r);
|
84
|
+
void set_value_at_thread_exit(R&& r);
|
85
|
+
void set_exception_at_thread_exit(exception_ptr p);
|
86
|
+
};
|
87
|
+
|
88
|
+
template <class R>
|
89
|
+
class promise<R&>
|
90
|
+
{
|
91
|
+
public:
|
92
|
+
promise();
|
93
|
+
template <class Allocator>
|
94
|
+
promise(allocator_arg_t, const Allocator& a);
|
95
|
+
promise(promise&& rhs) noexcept;
|
96
|
+
promise(const promise& rhs) = delete;
|
97
|
+
~promise();
|
98
|
+
|
99
|
+
// assignment
|
100
|
+
promise& operator=(promise&& rhs) noexcept;
|
101
|
+
promise& operator=(const promise& rhs) = delete;
|
102
|
+
void swap(promise& other) noexcept;
|
103
|
+
|
104
|
+
// retrieving the result
|
105
|
+
future<R&> get_future();
|
106
|
+
|
107
|
+
// setting the result
|
108
|
+
void set_value(R& r);
|
109
|
+
void set_exception(exception_ptr p);
|
110
|
+
|
111
|
+
// setting the result with deferred notification
|
112
|
+
void set_value_at_thread_exit(R&);
|
113
|
+
void set_exception_at_thread_exit(exception_ptr p);
|
114
|
+
};
|
115
|
+
|
116
|
+
template <>
|
117
|
+
class promise<void>
|
118
|
+
{
|
119
|
+
public:
|
120
|
+
promise();
|
121
|
+
template <class Allocator>
|
122
|
+
promise(allocator_arg_t, const Allocator& a);
|
123
|
+
promise(promise&& rhs) noexcept;
|
124
|
+
promise(const promise& rhs) = delete;
|
125
|
+
~promise();
|
126
|
+
|
127
|
+
// assignment
|
128
|
+
promise& operator=(promise&& rhs) noexcept;
|
129
|
+
promise& operator=(const promise& rhs) = delete;
|
130
|
+
void swap(promise& other) noexcept;
|
131
|
+
|
132
|
+
// retrieving the result
|
133
|
+
future<void> get_future();
|
134
|
+
|
135
|
+
// setting the result
|
136
|
+
void set_value();
|
137
|
+
void set_exception(exception_ptr p);
|
138
|
+
|
139
|
+
// setting the result with deferred notification
|
140
|
+
void set_value_at_thread_exit();
|
141
|
+
void set_exception_at_thread_exit(exception_ptr p);
|
142
|
+
};
|
143
|
+
|
144
|
+
template <class R> void swap(promise<R>& x, promise<R>& y) noexcept;
|
145
|
+
|
146
|
+
template <class R, class Alloc>
|
147
|
+
struct uses_allocator<promise<R>, Alloc> : public true_type {};
|
148
|
+
|
149
|
+
template <class R>
|
150
|
+
class future
|
151
|
+
{
|
152
|
+
public:
|
153
|
+
future() noexcept;
|
154
|
+
future(future&&) noexcept;
|
155
|
+
future(const future& rhs) = delete;
|
156
|
+
~future();
|
157
|
+
future& operator=(const future& rhs) = delete;
|
158
|
+
future& operator=(future&&) noexcept;
|
159
|
+
shared_future<R> share();
|
160
|
+
|
161
|
+
// retrieving the value
|
162
|
+
R get();
|
163
|
+
|
164
|
+
// functions to check state
|
165
|
+
bool valid() const noexcept;
|
166
|
+
|
167
|
+
void wait() const;
|
168
|
+
template <class Rep, class Period>
|
169
|
+
future_status
|
170
|
+
wait_for(const chrono::duration<Rep, Period>& rel_time) const;
|
171
|
+
template <class Clock, class Duration>
|
172
|
+
future_status
|
173
|
+
wait_until(const chrono::time_point<Clock, Duration>& abs_time) const;
|
174
|
+
};
|
175
|
+
|
176
|
+
template <class R>
|
177
|
+
class future<R&>
|
178
|
+
{
|
179
|
+
public:
|
180
|
+
future() noexcept;
|
181
|
+
future(future&&) noexcept;
|
182
|
+
future(const future& rhs) = delete;
|
183
|
+
~future();
|
184
|
+
future& operator=(const future& rhs) = delete;
|
185
|
+
future& operator=(future&&) noexcept;
|
186
|
+
shared_future<R&> share();
|
187
|
+
|
188
|
+
// retrieving the value
|
189
|
+
R& get();
|
190
|
+
|
191
|
+
// functions to check state
|
192
|
+
bool valid() const noexcept;
|
193
|
+
|
194
|
+
void wait() const;
|
195
|
+
template <class Rep, class Period>
|
196
|
+
future_status
|
197
|
+
wait_for(const chrono::duration<Rep, Period>& rel_time) const;
|
198
|
+
template <class Clock, class Duration>
|
199
|
+
future_status
|
200
|
+
wait_until(const chrono::time_point<Clock, Duration>& abs_time) const;
|
201
|
+
};
|
202
|
+
|
203
|
+
template <>
|
204
|
+
class future<void>
|
205
|
+
{
|
206
|
+
public:
|
207
|
+
future() noexcept;
|
208
|
+
future(future&&) noexcept;
|
209
|
+
future(const future& rhs) = delete;
|
210
|
+
~future();
|
211
|
+
future& operator=(const future& rhs) = delete;
|
212
|
+
future& operator=(future&&) noexcept;
|
213
|
+
shared_future<void> share();
|
214
|
+
|
215
|
+
// retrieving the value
|
216
|
+
void get();
|
217
|
+
|
218
|
+
// functions to check state
|
219
|
+
bool valid() const noexcept;
|
220
|
+
|
221
|
+
void wait() const;
|
222
|
+
template <class Rep, class Period>
|
223
|
+
future_status
|
224
|
+
wait_for(const chrono::duration<Rep, Period>& rel_time) const;
|
225
|
+
template <class Clock, class Duration>
|
226
|
+
future_status
|
227
|
+
wait_until(const chrono::time_point<Clock, Duration>& abs_time) const;
|
228
|
+
};
|
229
|
+
|
230
|
+
template <class R>
|
231
|
+
class shared_future
|
232
|
+
{
|
233
|
+
public:
|
234
|
+
shared_future() noexcept;
|
235
|
+
shared_future(const shared_future& rhs);
|
236
|
+
shared_future(future<R>&&) noexcept;
|
237
|
+
shared_future(shared_future&& rhs) noexcept;
|
238
|
+
~shared_future();
|
239
|
+
shared_future& operator=(const shared_future& rhs);
|
240
|
+
shared_future& operator=(shared_future&& rhs) noexcept;
|
241
|
+
|
242
|
+
// retrieving the value
|
243
|
+
const R& get() const;
|
244
|
+
|
245
|
+
// functions to check state
|
246
|
+
bool valid() const noexcept;
|
247
|
+
|
248
|
+
void wait() const;
|
249
|
+
template <class Rep, class Period>
|
250
|
+
future_status
|
251
|
+
wait_for(const chrono::duration<Rep, Period>& rel_time) const;
|
252
|
+
template <class Clock, class Duration>
|
253
|
+
future_status
|
254
|
+
wait_until(const chrono::time_point<Clock, Duration>& abs_time) const;
|
255
|
+
};
|
256
|
+
|
257
|
+
template <class R>
|
258
|
+
class shared_future<R&>
|
259
|
+
{
|
260
|
+
public:
|
261
|
+
shared_future() noexcept;
|
262
|
+
shared_future(const shared_future& rhs);
|
263
|
+
shared_future(future<R&>&&) noexcept;
|
264
|
+
shared_future(shared_future&& rhs) noexcept;
|
265
|
+
~shared_future();
|
266
|
+
shared_future& operator=(const shared_future& rhs);
|
267
|
+
shared_future& operator=(shared_future&& rhs) noexcept;
|
268
|
+
|
269
|
+
// retrieving the value
|
270
|
+
R& get() const;
|
271
|
+
|
272
|
+
// functions to check state
|
273
|
+
bool valid() const noexcept;
|
274
|
+
|
275
|
+
void wait() const;
|
276
|
+
template <class Rep, class Period>
|
277
|
+
future_status
|
278
|
+
wait_for(const chrono::duration<Rep, Period>& rel_time) const;
|
279
|
+
template <class Clock, class Duration>
|
280
|
+
future_status
|
281
|
+
wait_until(const chrono::time_point<Clock, Duration>& abs_time) const;
|
282
|
+
};
|
283
|
+
|
284
|
+
template <>
|
285
|
+
class shared_future<void>
|
286
|
+
{
|
287
|
+
public:
|
288
|
+
shared_future() noexcept;
|
289
|
+
shared_future(const shared_future& rhs);
|
290
|
+
shared_future(future<void>&&) noexcept;
|
291
|
+
shared_future(shared_future&& rhs) noexcept;
|
292
|
+
~shared_future();
|
293
|
+
shared_future& operator=(const shared_future& rhs);
|
294
|
+
shared_future& operator=(shared_future&& rhs) noexcept;
|
295
|
+
|
296
|
+
// retrieving the value
|
297
|
+
void get() const;
|
298
|
+
|
299
|
+
// functions to check state
|
300
|
+
bool valid() const noexcept;
|
301
|
+
|
302
|
+
void wait() const;
|
303
|
+
template <class Rep, class Period>
|
304
|
+
future_status
|
305
|
+
wait_for(const chrono::duration<Rep, Period>& rel_time) const;
|
306
|
+
template <class Clock, class Duration>
|
307
|
+
future_status
|
308
|
+
wait_until(const chrono::time_point<Clock, Duration>& abs_time) const;
|
309
|
+
};
|
310
|
+
|
311
|
+
template <class F, class... Args>
|
312
|
+
future<typename result_of<F(Args...)>::type>
|
313
|
+
async(F&& f, Args&&... args);
|
314
|
+
|
315
|
+
template <class F, class... Args>
|
316
|
+
future<typename result_of<F(Args...)>::type>
|
317
|
+
async(launch policy, F&& f, Args&&... args);
|
318
|
+
|
319
|
+
template <class> class packaged_task; // undefined
|
320
|
+
|
321
|
+
template <class R, class... ArgTypes>
|
322
|
+
class packaged_task<R(ArgTypes...)>
|
323
|
+
{
|
324
|
+
public:
|
325
|
+
typedef R result_type;
|
326
|
+
|
327
|
+
// construction and destruction
|
328
|
+
packaged_task() noexcept;
|
329
|
+
template <class F>
|
330
|
+
explicit packaged_task(F&& f);
|
331
|
+
template <class F, class Allocator>
|
332
|
+
explicit packaged_task(allocator_arg_t, const Allocator& a, F&& f);
|
333
|
+
~packaged_task();
|
334
|
+
|
335
|
+
// no copy
|
336
|
+
packaged_task(const packaged_task&) = delete;
|
337
|
+
packaged_task& operator=(const packaged_task&) = delete;
|
338
|
+
|
339
|
+
// move support
|
340
|
+
packaged_task(packaged_task&& other) noexcept;
|
341
|
+
packaged_task& operator=(packaged_task&& other) noexcept;
|
342
|
+
void swap(packaged_task& other) noexcept;
|
343
|
+
|
344
|
+
bool valid() const noexcept;
|
345
|
+
|
346
|
+
// result retrieval
|
347
|
+
future<R> get_future();
|
348
|
+
|
349
|
+
// execution
|
350
|
+
void operator()(ArgTypes... );
|
351
|
+
void make_ready_at_thread_exit(ArgTypes...);
|
352
|
+
|
353
|
+
void reset();
|
354
|
+
};
|
355
|
+
|
356
|
+
template <class R>
|
357
|
+
void swap(packaged_task<R(ArgTypes...)&, packaged_task<R(ArgTypes...)>&) noexcept;
|
358
|
+
|
359
|
+
template <class R, class Alloc> struct uses_allocator<packaged_task<R>, Alloc>;
|
360
|
+
|
361
|
+
} // std
|
362
|
+
|
363
|
+
*/
|
364
|
+
|
365
|
+
#include <__config>
|
366
|
+
#include <system_error>
|
367
|
+
#include <memory>
|
368
|
+
#include <chrono>
|
369
|
+
#include <exception>
|
370
|
+
#include <mutex>
|
371
|
+
#include <thread>
|
372
|
+
|
373
|
+
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
|
374
|
+
#pragma GCC system_header
|
375
|
+
#endif
|
376
|
+
|
377
|
+
_LIBCPP_BEGIN_NAMESPACE_STD
|
378
|
+
|
379
|
+
//enum class future_errc
|
380
|
+
_LIBCPP_DECLARE_STRONG_ENUM(future_errc)
|
381
|
+
{
|
382
|
+
broken_promise,
|
383
|
+
future_already_retrieved,
|
384
|
+
promise_already_satisfied,
|
385
|
+
no_state
|
386
|
+
};
|
387
|
+
_LIBCPP_DECLARE_STRONG_ENUM_EPILOG(future_errc)
|
388
|
+
|
389
|
+
template <>
|
390
|
+
struct _LIBCPP_TYPE_VIS is_error_code_enum<future_errc> : public true_type {};
|
391
|
+
|
392
|
+
#ifdef _LIBCPP_HAS_NO_STRONG_ENUMS
|
393
|
+
template <>
|
394
|
+
struct _LIBCPP_TYPE_VIS is_error_code_enum<future_errc::__lx> : public true_type { };
|
395
|
+
#endif
|
396
|
+
|
397
|
+
//enum class launch
|
398
|
+
_LIBCPP_DECLARE_STRONG_ENUM(launch)
|
399
|
+
{
|
400
|
+
async = 1,
|
401
|
+
deferred = 2,
|
402
|
+
any = async | deferred
|
403
|
+
};
|
404
|
+
_LIBCPP_DECLARE_STRONG_ENUM_EPILOG(launch)
|
405
|
+
|
406
|
+
//enum class future_status
|
407
|
+
_LIBCPP_DECLARE_STRONG_ENUM(future_status)
|
408
|
+
{
|
409
|
+
ready,
|
410
|
+
timeout,
|
411
|
+
deferred
|
412
|
+
};
|
413
|
+
_LIBCPP_DECLARE_STRONG_ENUM_EPILOG(future_status)
|
414
|
+
|
415
|
+
_LIBCPP_FUNC_VIS
|
416
|
+
const error_category& future_category() _NOEXCEPT;
|
417
|
+
|
418
|
+
inline _LIBCPP_INLINE_VISIBILITY
|
419
|
+
error_code
|
420
|
+
make_error_code(future_errc __e) _NOEXCEPT
|
421
|
+
{
|
422
|
+
return error_code(static_cast<int>(__e), future_category());
|
423
|
+
}
|
424
|
+
|
425
|
+
inline _LIBCPP_INLINE_VISIBILITY
|
426
|
+
error_condition
|
427
|
+
make_error_condition(future_errc __e) _NOEXCEPT
|
428
|
+
{
|
429
|
+
return error_condition(static_cast<int>(__e), future_category());
|
430
|
+
}
|
431
|
+
|
432
|
+
class _LIBCPP_EXCEPTION_ABI future_error
|
433
|
+
: public logic_error
|
434
|
+
{
|
435
|
+
error_code __ec_;
|
436
|
+
public:
|
437
|
+
future_error(error_code __ec);
|
438
|
+
|
439
|
+
_LIBCPP_INLINE_VISIBILITY
|
440
|
+
const error_code& code() const _NOEXCEPT {return __ec_;}
|
441
|
+
|
442
|
+
virtual ~future_error() _NOEXCEPT;
|
443
|
+
};
|
444
|
+
|
445
|
+
class __assoc_sub_state
|
446
|
+
: public __shared_count
|
447
|
+
{
|
448
|
+
protected:
|
449
|
+
exception_ptr __exception_;
|
450
|
+
mutable mutex __mut_;
|
451
|
+
mutable condition_variable __cv_;
|
452
|
+
unsigned __state_;
|
453
|
+
|
454
|
+
virtual void __on_zero_shared() _NOEXCEPT;
|
455
|
+
void __sub_wait(unique_lock<mutex>& __lk);
|
456
|
+
public:
|
457
|
+
enum
|
458
|
+
{
|
459
|
+
__constructed = 1,
|
460
|
+
__future_attached = 2,
|
461
|
+
ready = 4,
|
462
|
+
deferred = 8
|
463
|
+
};
|
464
|
+
|
465
|
+
_LIBCPP_INLINE_VISIBILITY
|
466
|
+
__assoc_sub_state() : __state_(0) {}
|
467
|
+
|
468
|
+
_LIBCPP_INLINE_VISIBILITY
|
469
|
+
bool __has_value() const
|
470
|
+
{return (__state_ & __constructed) || (__exception_ != nullptr);}
|
471
|
+
|
472
|
+
_LIBCPP_INLINE_VISIBILITY
|
473
|
+
void __set_future_attached()
|
474
|
+
{
|
475
|
+
lock_guard<mutex> __lk(__mut_);
|
476
|
+
__state_ |= __future_attached;
|
477
|
+
}
|
478
|
+
_LIBCPP_INLINE_VISIBILITY
|
479
|
+
bool __has_future_attached() const {return __state_ & __future_attached;}
|
480
|
+
|
481
|
+
_LIBCPP_INLINE_VISIBILITY
|
482
|
+
void __set_deferred() {__state_ |= deferred;}
|
483
|
+
|
484
|
+
void __make_ready();
|
485
|
+
_LIBCPP_INLINE_VISIBILITY
|
486
|
+
bool __is_ready() const {return __state_ & ready;}
|
487
|
+
|
488
|
+
void set_value();
|
489
|
+
void set_value_at_thread_exit();
|
490
|
+
|
491
|
+
void set_exception(exception_ptr __p);
|
492
|
+
void set_exception_at_thread_exit(exception_ptr __p);
|
493
|
+
|
494
|
+
void copy();
|
495
|
+
|
496
|
+
void wait();
|
497
|
+
template <class _Rep, class _Period>
|
498
|
+
future_status
|
499
|
+
wait_for(const chrono::duration<_Rep, _Period>& __rel_time) const;
|
500
|
+
template <class _Clock, class _Duration>
|
501
|
+
future_status
|
502
|
+
wait_until(const chrono::time_point<_Clock, _Duration>& __abs_time) const;
|
503
|
+
|
504
|
+
virtual void __execute();
|
505
|
+
};
|
506
|
+
|
507
|
+
template <class _Clock, class _Duration>
|
508
|
+
future_status
|
509
|
+
__assoc_sub_state::wait_until(const chrono::time_point<_Clock, _Duration>& __abs_time) const
|
510
|
+
{
|
511
|
+
unique_lock<mutex> __lk(__mut_);
|
512
|
+
if (__state_ & deferred)
|
513
|
+
return future_status::deferred;
|
514
|
+
while (!(__state_ & ready) && _Clock::now() < __abs_time)
|
515
|
+
__cv_.wait_until(__lk, __abs_time);
|
516
|
+
if (__state_ & ready)
|
517
|
+
return future_status::ready;
|
518
|
+
return future_status::timeout;
|
519
|
+
}
|
520
|
+
|
521
|
+
template <class _Rep, class _Period>
|
522
|
+
inline _LIBCPP_INLINE_VISIBILITY
|
523
|
+
future_status
|
524
|
+
__assoc_sub_state::wait_for(const chrono::duration<_Rep, _Period>& __rel_time) const
|
525
|
+
{
|
526
|
+
return wait_until(chrono::steady_clock::now() + __rel_time);
|
527
|
+
}
|
528
|
+
|
529
|
+
template <class _Rp>
|
530
|
+
class __assoc_state
|
531
|
+
: public __assoc_sub_state
|
532
|
+
{
|
533
|
+
typedef __assoc_sub_state base;
|
534
|
+
typedef typename aligned_storage<sizeof(_Rp), alignment_of<_Rp>::value>::type _Up;
|
535
|
+
protected:
|
536
|
+
_Up __value_;
|
537
|
+
|
538
|
+
virtual void __on_zero_shared() _NOEXCEPT;
|
539
|
+
public:
|
540
|
+
|
541
|
+
template <class _Arg>
|
542
|
+
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
543
|
+
void set_value(_Arg&& __arg);
|
544
|
+
#else
|
545
|
+
void set_value(_Arg& __arg);
|
546
|
+
#endif
|
547
|
+
|
548
|
+
template <class _Arg>
|
549
|
+
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
550
|
+
void set_value_at_thread_exit(_Arg&& __arg);
|
551
|
+
#else
|
552
|
+
void set_value_at_thread_exit(_Arg& __arg);
|
553
|
+
#endif
|
554
|
+
|
555
|
+
_Rp move();
|
556
|
+
typename add_lvalue_reference<_Rp>::type copy();
|
557
|
+
};
|
558
|
+
|
559
|
+
template <class _Rp>
|
560
|
+
void
|
561
|
+
__assoc_state<_Rp>::__on_zero_shared() _NOEXCEPT
|
562
|
+
{
|
563
|
+
if (this->__state_ & base::__constructed)
|
564
|
+
reinterpret_cast<_Rp*>(&__value_)->~_Rp();
|
565
|
+
delete this;
|
566
|
+
}
|
567
|
+
|
568
|
+
template <class _Rp>
|
569
|
+
template <class _Arg>
|
570
|
+
void
|
571
|
+
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
572
|
+
__assoc_state<_Rp>::set_value(_Arg&& __arg)
|
573
|
+
#else
|
574
|
+
__assoc_state<_Rp>::set_value(_Arg& __arg)
|
575
|
+
#endif
|
576
|
+
{
|
577
|
+
unique_lock<mutex> __lk(this->__mut_);
|
578
|
+
#ifndef _LIBCPP_NO_EXCEPTIONS
|
579
|
+
if (this->__has_value())
|
580
|
+
throw future_error(make_error_code(future_errc::promise_already_satisfied));
|
581
|
+
#endif
|
582
|
+
::new(&__value_) _Rp(_VSTD::forward<_Arg>(__arg));
|
583
|
+
this->__state_ |= base::__constructed | base::ready;
|
584
|
+
__lk.unlock();
|
585
|
+
__cv_.notify_all();
|
586
|
+
}
|
587
|
+
|
588
|
+
template <class _Rp>
|
589
|
+
template <class _Arg>
|
590
|
+
void
|
591
|
+
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
592
|
+
__assoc_state<_Rp>::set_value_at_thread_exit(_Arg&& __arg)
|
593
|
+
#else
|
594
|
+
__assoc_state<_Rp>::set_value_at_thread_exit(_Arg& __arg)
|
595
|
+
#endif
|
596
|
+
{
|
597
|
+
unique_lock<mutex> __lk(this->__mut_);
|
598
|
+
#ifndef _LIBCPP_NO_EXCEPTIONS
|
599
|
+
if (this->__has_value())
|
600
|
+
throw future_error(make_error_code(future_errc::promise_already_satisfied));
|
601
|
+
#endif
|
602
|
+
::new(&__value_) _Rp(_VSTD::forward<_Arg>(__arg));
|
603
|
+
this->__state_ |= base::__constructed;
|
604
|
+
__thread_local_data()->__make_ready_at_thread_exit(this);
|
605
|
+
__lk.unlock();
|
606
|
+
}
|
607
|
+
|
608
|
+
template <class _Rp>
|
609
|
+
_Rp
|
610
|
+
__assoc_state<_Rp>::move()
|
611
|
+
{
|
612
|
+
unique_lock<mutex> __lk(this->__mut_);
|
613
|
+
this->__sub_wait(__lk);
|
614
|
+
if (this->__exception_ != nullptr)
|
615
|
+
rethrow_exception(this->__exception_);
|
616
|
+
return _VSTD::move(*reinterpret_cast<_Rp*>(&__value_));
|
617
|
+
}
|
618
|
+
|
619
|
+
template <class _Rp>
|
620
|
+
typename add_lvalue_reference<_Rp>::type
|
621
|
+
__assoc_state<_Rp>::copy()
|
622
|
+
{
|
623
|
+
unique_lock<mutex> __lk(this->__mut_);
|
624
|
+
this->__sub_wait(__lk);
|
625
|
+
if (this->__exception_ != nullptr)
|
626
|
+
rethrow_exception(this->__exception_);
|
627
|
+
return *reinterpret_cast<_Rp*>(&__value_);
|
628
|
+
}
|
629
|
+
|
630
|
+
template <class _Rp>
|
631
|
+
class __assoc_state<_Rp&>
|
632
|
+
: public __assoc_sub_state
|
633
|
+
{
|
634
|
+
typedef __assoc_sub_state base;
|
635
|
+
typedef _Rp* _Up;
|
636
|
+
protected:
|
637
|
+
_Up __value_;
|
638
|
+
|
639
|
+
virtual void __on_zero_shared() _NOEXCEPT;
|
640
|
+
public:
|
641
|
+
|
642
|
+
void set_value(_Rp& __arg);
|
643
|
+
void set_value_at_thread_exit(_Rp& __arg);
|
644
|
+
|
645
|
+
_Rp& copy();
|
646
|
+
};
|
647
|
+
|
648
|
+
template <class _Rp>
|
649
|
+
void
|
650
|
+
__assoc_state<_Rp&>::__on_zero_shared() _NOEXCEPT
|
651
|
+
{
|
652
|
+
delete this;
|
653
|
+
}
|
654
|
+
|
655
|
+
template <class _Rp>
|
656
|
+
void
|
657
|
+
__assoc_state<_Rp&>::set_value(_Rp& __arg)
|
658
|
+
{
|
659
|
+
unique_lock<mutex> __lk(this->__mut_);
|
660
|
+
#ifndef _LIBCPP_NO_EXCEPTIONS
|
661
|
+
if (this->__has_value())
|
662
|
+
throw future_error(make_error_code(future_errc::promise_already_satisfied));
|
663
|
+
#endif
|
664
|
+
__value_ = &__arg;
|
665
|
+
this->__state_ |= base::__constructed | base::ready;
|
666
|
+
__lk.unlock();
|
667
|
+
__cv_.notify_all();
|
668
|
+
}
|
669
|
+
|
670
|
+
template <class _Rp>
|
671
|
+
void
|
672
|
+
__assoc_state<_Rp&>::set_value_at_thread_exit(_Rp& __arg)
|
673
|
+
{
|
674
|
+
unique_lock<mutex> __lk(this->__mut_);
|
675
|
+
#ifndef _LIBCPP_NO_EXCEPTIONS
|
676
|
+
if (this->__has_value())
|
677
|
+
throw future_error(make_error_code(future_errc::promise_already_satisfied));
|
678
|
+
#endif
|
679
|
+
__value_ = &__arg;
|
680
|
+
this->__state_ |= base::__constructed;
|
681
|
+
__thread_local_data()->__make_ready_at_thread_exit(this);
|
682
|
+
__lk.unlock();
|
683
|
+
}
|
684
|
+
|
685
|
+
template <class _Rp>
|
686
|
+
_Rp&
|
687
|
+
__assoc_state<_Rp&>::copy()
|
688
|
+
{
|
689
|
+
unique_lock<mutex> __lk(this->__mut_);
|
690
|
+
this->__sub_wait(__lk);
|
691
|
+
if (this->__exception_ != nullptr)
|
692
|
+
rethrow_exception(this->__exception_);
|
693
|
+
return *__value_;
|
694
|
+
}
|
695
|
+
|
696
|
+
template <class _Rp, class _Alloc>
|
697
|
+
class __assoc_state_alloc
|
698
|
+
: public __assoc_state<_Rp>
|
699
|
+
{
|
700
|
+
typedef __assoc_state<_Rp> base;
|
701
|
+
_Alloc __alloc_;
|
702
|
+
|
703
|
+
virtual void __on_zero_shared() _NOEXCEPT;
|
704
|
+
public:
|
705
|
+
_LIBCPP_INLINE_VISIBILITY
|
706
|
+
explicit __assoc_state_alloc(const _Alloc& __a)
|
707
|
+
: __alloc_(__a) {}
|
708
|
+
};
|
709
|
+
|
710
|
+
template <class _Rp, class _Alloc>
|
711
|
+
void
|
712
|
+
__assoc_state_alloc<_Rp, _Alloc>::__on_zero_shared() _NOEXCEPT
|
713
|
+
{
|
714
|
+
if (this->__state_ & base::__constructed)
|
715
|
+
reinterpret_cast<_Rp*>(&this->__value_)->~_Rp();
|
716
|
+
typename _Alloc::template rebind<__assoc_state_alloc>::other __a(__alloc_);
|
717
|
+
this->~__assoc_state_alloc();
|
718
|
+
__a.deallocate(this, 1);
|
719
|
+
}
|
720
|
+
|
721
|
+
template <class _Rp, class _Alloc>
|
722
|
+
class __assoc_state_alloc<_Rp&, _Alloc>
|
723
|
+
: public __assoc_state<_Rp&>
|
724
|
+
{
|
725
|
+
typedef __assoc_state<_Rp&> base;
|
726
|
+
_Alloc __alloc_;
|
727
|
+
|
728
|
+
virtual void __on_zero_shared() _NOEXCEPT;
|
729
|
+
public:
|
730
|
+
_LIBCPP_INLINE_VISIBILITY
|
731
|
+
explicit __assoc_state_alloc(const _Alloc& __a)
|
732
|
+
: __alloc_(__a) {}
|
733
|
+
};
|
734
|
+
|
735
|
+
template <class _Rp, class _Alloc>
|
736
|
+
void
|
737
|
+
__assoc_state_alloc<_Rp&, _Alloc>::__on_zero_shared() _NOEXCEPT
|
738
|
+
{
|
739
|
+
typename _Alloc::template rebind<__assoc_state_alloc>::other __a(__alloc_);
|
740
|
+
this->~__assoc_state_alloc();
|
741
|
+
__a.deallocate(this, 1);
|
742
|
+
}
|
743
|
+
|
744
|
+
template <class _Alloc>
|
745
|
+
class __assoc_sub_state_alloc
|
746
|
+
: public __assoc_sub_state
|
747
|
+
{
|
748
|
+
typedef __assoc_sub_state base;
|
749
|
+
_Alloc __alloc_;
|
750
|
+
|
751
|
+
virtual void __on_zero_shared() _NOEXCEPT;
|
752
|
+
public:
|
753
|
+
_LIBCPP_INLINE_VISIBILITY
|
754
|
+
explicit __assoc_sub_state_alloc(const _Alloc& __a)
|
755
|
+
: __alloc_(__a) {}
|
756
|
+
};
|
757
|
+
|
758
|
+
template <class _Alloc>
|
759
|
+
void
|
760
|
+
__assoc_sub_state_alloc<_Alloc>::__on_zero_shared() _NOEXCEPT
|
761
|
+
{
|
762
|
+
typename _Alloc::template rebind<__assoc_sub_state_alloc>::other __a(__alloc_);
|
763
|
+
this->~__assoc_sub_state_alloc();
|
764
|
+
__a.deallocate(this, 1);
|
765
|
+
}
|
766
|
+
|
767
|
+
template <class _Rp, class _Fp>
|
768
|
+
class __deferred_assoc_state
|
769
|
+
: public __assoc_state<_Rp>
|
770
|
+
{
|
771
|
+
typedef __assoc_state<_Rp> base;
|
772
|
+
|
773
|
+
_Fp __func_;
|
774
|
+
|
775
|
+
public:
|
776
|
+
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
777
|
+
explicit __deferred_assoc_state(_Fp&& __f);
|
778
|
+
#endif
|
779
|
+
|
780
|
+
virtual void __execute();
|
781
|
+
};
|
782
|
+
|
783
|
+
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
784
|
+
|
785
|
+
template <class _Rp, class _Fp>
|
786
|
+
inline _LIBCPP_INLINE_VISIBILITY
|
787
|
+
__deferred_assoc_state<_Rp, _Fp>::__deferred_assoc_state(_Fp&& __f)
|
788
|
+
: __func_(_VSTD::forward<_Fp>(__f))
|
789
|
+
{
|
790
|
+
this->__set_deferred();
|
791
|
+
}
|
792
|
+
|
793
|
+
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
794
|
+
|
795
|
+
template <class _Rp, class _Fp>
|
796
|
+
void
|
797
|
+
__deferred_assoc_state<_Rp, _Fp>::__execute()
|
798
|
+
{
|
799
|
+
#ifndef _LIBCPP_NO_EXCEPTIONS
|
800
|
+
try
|
801
|
+
{
|
802
|
+
#endif // _LIBCPP_NO_EXCEPTIONS
|
803
|
+
this->set_value(__func_());
|
804
|
+
#ifndef _LIBCPP_NO_EXCEPTIONS
|
805
|
+
}
|
806
|
+
catch (...)
|
807
|
+
{
|
808
|
+
this->set_exception(current_exception());
|
809
|
+
}
|
810
|
+
#endif // _LIBCPP_NO_EXCEPTIONS
|
811
|
+
}
|
812
|
+
|
813
|
+
template <class _Fp>
|
814
|
+
class __deferred_assoc_state<void, _Fp>
|
815
|
+
: public __assoc_sub_state
|
816
|
+
{
|
817
|
+
typedef __assoc_sub_state base;
|
818
|
+
|
819
|
+
_Fp __func_;
|
820
|
+
|
821
|
+
public:
|
822
|
+
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
823
|
+
explicit __deferred_assoc_state(_Fp&& __f);
|
824
|
+
#endif
|
825
|
+
|
826
|
+
virtual void __execute();
|
827
|
+
};
|
828
|
+
|
829
|
+
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
830
|
+
|
831
|
+
template <class _Fp>
|
832
|
+
inline _LIBCPP_INLINE_VISIBILITY
|
833
|
+
__deferred_assoc_state<void, _Fp>::__deferred_assoc_state(_Fp&& __f)
|
834
|
+
: __func_(_VSTD::forward<_Fp>(__f))
|
835
|
+
{
|
836
|
+
this->__set_deferred();
|
837
|
+
}
|
838
|
+
|
839
|
+
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
840
|
+
|
841
|
+
template <class _Fp>
|
842
|
+
void
|
843
|
+
__deferred_assoc_state<void, _Fp>::__execute()
|
844
|
+
{
|
845
|
+
#ifndef _LIBCPP_NO_EXCEPTIONS
|
846
|
+
try
|
847
|
+
{
|
848
|
+
#endif // _LIBCPP_NO_EXCEPTIONS
|
849
|
+
__func_();
|
850
|
+
this->set_value();
|
851
|
+
#ifndef _LIBCPP_NO_EXCEPTIONS
|
852
|
+
}
|
853
|
+
catch (...)
|
854
|
+
{
|
855
|
+
this->set_exception(current_exception());
|
856
|
+
}
|
857
|
+
#endif // _LIBCPP_NO_EXCEPTIONS
|
858
|
+
}
|
859
|
+
|
860
|
+
template <class _Rp, class _Fp>
|
861
|
+
class __async_assoc_state
|
862
|
+
: public __assoc_state<_Rp>
|
863
|
+
{
|
864
|
+
typedef __assoc_state<_Rp> base;
|
865
|
+
|
866
|
+
_Fp __func_;
|
867
|
+
|
868
|
+
virtual void __on_zero_shared() _NOEXCEPT;
|
869
|
+
public:
|
870
|
+
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
871
|
+
explicit __async_assoc_state(_Fp&& __f);
|
872
|
+
#endif
|
873
|
+
|
874
|
+
virtual void __execute();
|
875
|
+
};
|
876
|
+
|
877
|
+
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
878
|
+
|
879
|
+
template <class _Rp, class _Fp>
|
880
|
+
inline _LIBCPP_INLINE_VISIBILITY
|
881
|
+
__async_assoc_state<_Rp, _Fp>::__async_assoc_state(_Fp&& __f)
|
882
|
+
: __func_(_VSTD::forward<_Fp>(__f))
|
883
|
+
{
|
884
|
+
}
|
885
|
+
|
886
|
+
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
887
|
+
|
888
|
+
template <class _Rp, class _Fp>
|
889
|
+
void
|
890
|
+
__async_assoc_state<_Rp, _Fp>::__execute()
|
891
|
+
{
|
892
|
+
#ifndef _LIBCPP_NO_EXCEPTIONS
|
893
|
+
try
|
894
|
+
{
|
895
|
+
#endif // _LIBCPP_NO_EXCEPTIONS
|
896
|
+
this->set_value(__func_());
|
897
|
+
#ifndef _LIBCPP_NO_EXCEPTIONS
|
898
|
+
}
|
899
|
+
catch (...)
|
900
|
+
{
|
901
|
+
this->set_exception(current_exception());
|
902
|
+
}
|
903
|
+
#endif // _LIBCPP_NO_EXCEPTIONS
|
904
|
+
}
|
905
|
+
|
906
|
+
template <class _Rp, class _Fp>
|
907
|
+
void
|
908
|
+
__async_assoc_state<_Rp, _Fp>::__on_zero_shared() _NOEXCEPT
|
909
|
+
{
|
910
|
+
this->wait();
|
911
|
+
base::__on_zero_shared();
|
912
|
+
}
|
913
|
+
|
914
|
+
template <class _Fp>
|
915
|
+
class __async_assoc_state<void, _Fp>
|
916
|
+
: public __assoc_sub_state
|
917
|
+
{
|
918
|
+
typedef __assoc_sub_state base;
|
919
|
+
|
920
|
+
_Fp __func_;
|
921
|
+
|
922
|
+
virtual void __on_zero_shared() _NOEXCEPT;
|
923
|
+
public:
|
924
|
+
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
925
|
+
explicit __async_assoc_state(_Fp&& __f);
|
926
|
+
#endif
|
927
|
+
|
928
|
+
virtual void __execute();
|
929
|
+
};
|
930
|
+
|
931
|
+
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
932
|
+
|
933
|
+
template <class _Fp>
|
934
|
+
inline _LIBCPP_INLINE_VISIBILITY
|
935
|
+
__async_assoc_state<void, _Fp>::__async_assoc_state(_Fp&& __f)
|
936
|
+
: __func_(_VSTD::forward<_Fp>(__f))
|
937
|
+
{
|
938
|
+
}
|
939
|
+
|
940
|
+
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
941
|
+
|
942
|
+
template <class _Fp>
|
943
|
+
void
|
944
|
+
__async_assoc_state<void, _Fp>::__execute()
|
945
|
+
{
|
946
|
+
#ifndef _LIBCPP_NO_EXCEPTIONS
|
947
|
+
try
|
948
|
+
{
|
949
|
+
#endif // _LIBCPP_NO_EXCEPTIONS
|
950
|
+
__func_();
|
951
|
+
this->set_value();
|
952
|
+
#ifndef _LIBCPP_NO_EXCEPTIONS
|
953
|
+
}
|
954
|
+
catch (...)
|
955
|
+
{
|
956
|
+
this->set_exception(current_exception());
|
957
|
+
}
|
958
|
+
#endif // _LIBCPP_NO_EXCEPTIONS
|
959
|
+
}
|
960
|
+
|
961
|
+
template <class _Fp>
|
962
|
+
void
|
963
|
+
__async_assoc_state<void, _Fp>::__on_zero_shared() _NOEXCEPT
|
964
|
+
{
|
965
|
+
this->wait();
|
966
|
+
base::__on_zero_shared();
|
967
|
+
}
|
968
|
+
|
969
|
+
template <class _Rp> class _LIBCPP_TYPE_VIS promise;
|
970
|
+
template <class _Rp> class _LIBCPP_TYPE_VIS shared_future;
|
971
|
+
|
972
|
+
// future
|
973
|
+
|
974
|
+
template <class _Rp> class _LIBCPP_TYPE_VIS future;
|
975
|
+
|
976
|
+
template <class _Rp, class _Fp>
|
977
|
+
future<_Rp>
|
978
|
+
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
979
|
+
__make_deferred_assoc_state(_Fp&& __f);
|
980
|
+
#else
|
981
|
+
__make_deferred_assoc_state(_Fp __f);
|
982
|
+
#endif
|
983
|
+
|
984
|
+
template <class _Rp, class _Fp>
|
985
|
+
future<_Rp>
|
986
|
+
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
987
|
+
__make_async_assoc_state(_Fp&& __f);
|
988
|
+
#else
|
989
|
+
__make_async_assoc_state(_Fp __f);
|
990
|
+
#endif
|
991
|
+
|
992
|
+
template <class _Rp>
|
993
|
+
class _LIBCPP_TYPE_VIS future
|
994
|
+
{
|
995
|
+
__assoc_state<_Rp>* __state_;
|
996
|
+
|
997
|
+
explicit future(__assoc_state<_Rp>* __state);
|
998
|
+
|
999
|
+
template <class> friend class promise;
|
1000
|
+
template <class> friend class shared_future;
|
1001
|
+
|
1002
|
+
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
1003
|
+
template <class _R1, class _Fp>
|
1004
|
+
friend future<_R1> __make_deferred_assoc_state(_Fp&& __f);
|
1005
|
+
template <class _R1, class _Fp>
|
1006
|
+
friend future<_R1> __make_async_assoc_state(_Fp&& __f);
|
1007
|
+
#else
|
1008
|
+
template <class _R1, class _Fp>
|
1009
|
+
friend future<_R1> __make_deferred_assoc_state(_Fp __f);
|
1010
|
+
template <class _R1, class _Fp>
|
1011
|
+
friend future<_R1> __make_async_assoc_state(_Fp __f);
|
1012
|
+
#endif
|
1013
|
+
|
1014
|
+
public:
|
1015
|
+
_LIBCPP_INLINE_VISIBILITY
|
1016
|
+
future() _NOEXCEPT : __state_(nullptr) {}
|
1017
|
+
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
1018
|
+
_LIBCPP_INLINE_VISIBILITY
|
1019
|
+
future(future&& __rhs) _NOEXCEPT
|
1020
|
+
: __state_(__rhs.__state_) {__rhs.__state_ = nullptr;}
|
1021
|
+
future(const future&) = delete;
|
1022
|
+
future& operator=(const future&) = delete;
|
1023
|
+
_LIBCPP_INLINE_VISIBILITY
|
1024
|
+
future& operator=(future&& __rhs) _NOEXCEPT
|
1025
|
+
{
|
1026
|
+
future(std::move(__rhs)).swap(*this);
|
1027
|
+
return *this;
|
1028
|
+
}
|
1029
|
+
#else // _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
1030
|
+
private:
|
1031
|
+
future(const future&);
|
1032
|
+
future& operator=(const future&);
|
1033
|
+
public:
|
1034
|
+
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
1035
|
+
~future();
|
1036
|
+
shared_future<_Rp> share();
|
1037
|
+
|
1038
|
+
// retrieving the value
|
1039
|
+
_Rp get();
|
1040
|
+
|
1041
|
+
_LIBCPP_INLINE_VISIBILITY
|
1042
|
+
void swap(future& __rhs) _NOEXCEPT {_VSTD::swap(__state_, __rhs.__state_);}
|
1043
|
+
|
1044
|
+
// functions to check state
|
1045
|
+
_LIBCPP_INLINE_VISIBILITY
|
1046
|
+
bool valid() const _NOEXCEPT {return __state_ != nullptr;}
|
1047
|
+
|
1048
|
+
_LIBCPP_INLINE_VISIBILITY
|
1049
|
+
void wait() const {__state_->wait();}
|
1050
|
+
template <class _Rep, class _Period>
|
1051
|
+
_LIBCPP_INLINE_VISIBILITY
|
1052
|
+
future_status
|
1053
|
+
wait_for(const chrono::duration<_Rep, _Period>& __rel_time) const
|
1054
|
+
{return __state_->wait_for(__rel_time);}
|
1055
|
+
template <class _Clock, class _Duration>
|
1056
|
+
_LIBCPP_INLINE_VISIBILITY
|
1057
|
+
future_status
|
1058
|
+
wait_until(const chrono::time_point<_Clock, _Duration>& __abs_time) const
|
1059
|
+
{return __state_->wait_until(__abs_time);}
|
1060
|
+
};
|
1061
|
+
|
1062
|
+
template <class _Rp>
|
1063
|
+
future<_Rp>::future(__assoc_state<_Rp>* __state)
|
1064
|
+
: __state_(__state)
|
1065
|
+
{
|
1066
|
+
#ifndef _LIBCPP_NO_EXCEPTIONS
|
1067
|
+
if (__state_->__has_future_attached())
|
1068
|
+
throw future_error(make_error_code(future_errc::future_already_retrieved));
|
1069
|
+
#endif
|
1070
|
+
__state_->__add_shared();
|
1071
|
+
__state_->__set_future_attached();
|
1072
|
+
}
|
1073
|
+
|
1074
|
+
struct __release_shared_count
|
1075
|
+
{
|
1076
|
+
void operator()(__shared_count* p) {p->__release_shared();}
|
1077
|
+
};
|
1078
|
+
|
1079
|
+
template <class _Rp>
|
1080
|
+
future<_Rp>::~future()
|
1081
|
+
{
|
1082
|
+
if (__state_)
|
1083
|
+
__state_->__release_shared();
|
1084
|
+
}
|
1085
|
+
|
1086
|
+
template <class _Rp>
|
1087
|
+
_Rp
|
1088
|
+
future<_Rp>::get()
|
1089
|
+
{
|
1090
|
+
unique_ptr<__shared_count, __release_shared_count> __(__state_);
|
1091
|
+
__assoc_state<_Rp>* __s = __state_;
|
1092
|
+
__state_ = nullptr;
|
1093
|
+
return __s->move();
|
1094
|
+
}
|
1095
|
+
|
1096
|
+
template <class _Rp>
|
1097
|
+
class _LIBCPP_TYPE_VIS future<_Rp&>
|
1098
|
+
{
|
1099
|
+
__assoc_state<_Rp&>* __state_;
|
1100
|
+
|
1101
|
+
explicit future(__assoc_state<_Rp&>* __state);
|
1102
|
+
|
1103
|
+
template <class> friend class promise;
|
1104
|
+
template <class> friend class shared_future;
|
1105
|
+
|
1106
|
+
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
1107
|
+
template <class _R1, class _Fp>
|
1108
|
+
friend future<_R1> __make_deferred_assoc_state(_Fp&& __f);
|
1109
|
+
template <class _R1, class _Fp>
|
1110
|
+
friend future<_R1> __make_async_assoc_state(_Fp&& __f);
|
1111
|
+
#else
|
1112
|
+
template <class _R1, class _Fp>
|
1113
|
+
friend future<_R1> __make_deferred_assoc_state(_Fp __f);
|
1114
|
+
template <class _R1, class _Fp>
|
1115
|
+
friend future<_R1> __make_async_assoc_state(_Fp __f);
|
1116
|
+
#endif
|
1117
|
+
|
1118
|
+
public:
|
1119
|
+
_LIBCPP_INLINE_VISIBILITY
|
1120
|
+
future() _NOEXCEPT : __state_(nullptr) {}
|
1121
|
+
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
1122
|
+
_LIBCPP_INLINE_VISIBILITY
|
1123
|
+
future(future&& __rhs) _NOEXCEPT
|
1124
|
+
: __state_(__rhs.__state_) {__rhs.__state_ = nullptr;}
|
1125
|
+
future(const future&) = delete;
|
1126
|
+
future& operator=(const future&) = delete;
|
1127
|
+
_LIBCPP_INLINE_VISIBILITY
|
1128
|
+
future& operator=(future&& __rhs) _NOEXCEPT
|
1129
|
+
{
|
1130
|
+
future(std::move(__rhs)).swap(*this);
|
1131
|
+
return *this;
|
1132
|
+
}
|
1133
|
+
#else // _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
1134
|
+
private:
|
1135
|
+
future(const future&);
|
1136
|
+
future& operator=(const future&);
|
1137
|
+
public:
|
1138
|
+
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
1139
|
+
~future();
|
1140
|
+
shared_future<_Rp&> share();
|
1141
|
+
|
1142
|
+
// retrieving the value
|
1143
|
+
_Rp& get();
|
1144
|
+
|
1145
|
+
_LIBCPP_INLINE_VISIBILITY
|
1146
|
+
void swap(future& __rhs) _NOEXCEPT {_VSTD::swap(__state_, __rhs.__state_);}
|
1147
|
+
|
1148
|
+
// functions to check state
|
1149
|
+
_LIBCPP_INLINE_VISIBILITY
|
1150
|
+
bool valid() const _NOEXCEPT {return __state_ != nullptr;}
|
1151
|
+
|
1152
|
+
_LIBCPP_INLINE_VISIBILITY
|
1153
|
+
void wait() const {__state_->wait();}
|
1154
|
+
template <class _Rep, class _Period>
|
1155
|
+
_LIBCPP_INLINE_VISIBILITY
|
1156
|
+
future_status
|
1157
|
+
wait_for(const chrono::duration<_Rep, _Period>& __rel_time) const
|
1158
|
+
{return __state_->wait_for(__rel_time);}
|
1159
|
+
template <class _Clock, class _Duration>
|
1160
|
+
_LIBCPP_INLINE_VISIBILITY
|
1161
|
+
future_status
|
1162
|
+
wait_until(const chrono::time_point<_Clock, _Duration>& __abs_time) const
|
1163
|
+
{return __state_->wait_until(__abs_time);}
|
1164
|
+
};
|
1165
|
+
|
1166
|
+
template <class _Rp>
|
1167
|
+
future<_Rp&>::future(__assoc_state<_Rp&>* __state)
|
1168
|
+
: __state_(__state)
|
1169
|
+
{
|
1170
|
+
#ifndef _LIBCPP_NO_EXCEPTIONS
|
1171
|
+
if (__state_->__has_future_attached())
|
1172
|
+
throw future_error(make_error_code(future_errc::future_already_retrieved));
|
1173
|
+
#endif
|
1174
|
+
__state_->__add_shared();
|
1175
|
+
__state_->__set_future_attached();
|
1176
|
+
}
|
1177
|
+
|
1178
|
+
template <class _Rp>
|
1179
|
+
future<_Rp&>::~future()
|
1180
|
+
{
|
1181
|
+
if (__state_)
|
1182
|
+
__state_->__release_shared();
|
1183
|
+
}
|
1184
|
+
|
1185
|
+
template <class _Rp>
|
1186
|
+
_Rp&
|
1187
|
+
future<_Rp&>::get()
|
1188
|
+
{
|
1189
|
+
unique_ptr<__shared_count, __release_shared_count> __(__state_);
|
1190
|
+
__assoc_state<_Rp&>* __s = __state_;
|
1191
|
+
__state_ = nullptr;
|
1192
|
+
return __s->copy();
|
1193
|
+
}
|
1194
|
+
|
1195
|
+
template <>
|
1196
|
+
class _LIBCPP_TYPE_VIS future<void>
|
1197
|
+
{
|
1198
|
+
__assoc_sub_state* __state_;
|
1199
|
+
|
1200
|
+
explicit future(__assoc_sub_state* __state);
|
1201
|
+
|
1202
|
+
template <class> friend class promise;
|
1203
|
+
template <class> friend class shared_future;
|
1204
|
+
|
1205
|
+
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
1206
|
+
template <class _R1, class _Fp>
|
1207
|
+
friend future<_R1> __make_deferred_assoc_state(_Fp&& __f);
|
1208
|
+
template <class _R1, class _Fp>
|
1209
|
+
friend future<_R1> __make_async_assoc_state(_Fp&& __f);
|
1210
|
+
#else
|
1211
|
+
template <class _R1, class _Fp>
|
1212
|
+
friend future<_R1> __make_deferred_assoc_state(_Fp __f);
|
1213
|
+
template <class _R1, class _Fp>
|
1214
|
+
friend future<_R1> __make_async_assoc_state(_Fp __f);
|
1215
|
+
#endif
|
1216
|
+
|
1217
|
+
public:
|
1218
|
+
_LIBCPP_INLINE_VISIBILITY
|
1219
|
+
future() _NOEXCEPT : __state_(nullptr) {}
|
1220
|
+
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
1221
|
+
_LIBCPP_INLINE_VISIBILITY
|
1222
|
+
future(future&& __rhs) _NOEXCEPT
|
1223
|
+
: __state_(__rhs.__state_) {__rhs.__state_ = nullptr;}
|
1224
|
+
future(const future&) = delete;
|
1225
|
+
future& operator=(const future&) = delete;
|
1226
|
+
_LIBCPP_INLINE_VISIBILITY
|
1227
|
+
future& operator=(future&& __rhs) _NOEXCEPT
|
1228
|
+
{
|
1229
|
+
future(std::move(__rhs)).swap(*this);
|
1230
|
+
return *this;
|
1231
|
+
}
|
1232
|
+
#else // _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
1233
|
+
private:
|
1234
|
+
future(const future&);
|
1235
|
+
future& operator=(const future&);
|
1236
|
+
public:
|
1237
|
+
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
1238
|
+
~future();
|
1239
|
+
shared_future<void> share();
|
1240
|
+
|
1241
|
+
// retrieving the value
|
1242
|
+
void get();
|
1243
|
+
|
1244
|
+
_LIBCPP_INLINE_VISIBILITY
|
1245
|
+
void swap(future& __rhs) _NOEXCEPT {_VSTD::swap(__state_, __rhs.__state_);}
|
1246
|
+
|
1247
|
+
// functions to check state
|
1248
|
+
_LIBCPP_INLINE_VISIBILITY
|
1249
|
+
bool valid() const _NOEXCEPT {return __state_ != nullptr;}
|
1250
|
+
|
1251
|
+
_LIBCPP_INLINE_VISIBILITY
|
1252
|
+
void wait() const {__state_->wait();}
|
1253
|
+
template <class _Rep, class _Period>
|
1254
|
+
_LIBCPP_INLINE_VISIBILITY
|
1255
|
+
future_status
|
1256
|
+
wait_for(const chrono::duration<_Rep, _Period>& __rel_time) const
|
1257
|
+
{return __state_->wait_for(__rel_time);}
|
1258
|
+
template <class _Clock, class _Duration>
|
1259
|
+
_LIBCPP_INLINE_VISIBILITY
|
1260
|
+
future_status
|
1261
|
+
wait_until(const chrono::time_point<_Clock, _Duration>& __abs_time) const
|
1262
|
+
{return __state_->wait_until(__abs_time);}
|
1263
|
+
};
|
1264
|
+
|
1265
|
+
template <class _Rp>
|
1266
|
+
inline _LIBCPP_INLINE_VISIBILITY
|
1267
|
+
void
|
1268
|
+
swap(future<_Rp>& __x, future<_Rp>& __y) _NOEXCEPT
|
1269
|
+
{
|
1270
|
+
__x.swap(__y);
|
1271
|
+
}
|
1272
|
+
|
1273
|
+
// promise<R>
|
1274
|
+
|
1275
|
+
template <class _Callable> class packaged_task;
|
1276
|
+
|
1277
|
+
template <class _Rp>
|
1278
|
+
class _LIBCPP_TYPE_VIS promise
|
1279
|
+
{
|
1280
|
+
__assoc_state<_Rp>* __state_;
|
1281
|
+
|
1282
|
+
_LIBCPP_INLINE_VISIBILITY
|
1283
|
+
explicit promise(nullptr_t) _NOEXCEPT : __state_(nullptr) {}
|
1284
|
+
|
1285
|
+
template <class> friend class packaged_task;
|
1286
|
+
public:
|
1287
|
+
promise();
|
1288
|
+
template <class _Alloc>
|
1289
|
+
promise(allocator_arg_t, const _Alloc& __a);
|
1290
|
+
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
1291
|
+
_LIBCPP_INLINE_VISIBILITY
|
1292
|
+
promise(promise&& __rhs) _NOEXCEPT
|
1293
|
+
: __state_(__rhs.__state_) {__rhs.__state_ = nullptr;}
|
1294
|
+
promise(const promise& __rhs) = delete;
|
1295
|
+
#else // _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
1296
|
+
private:
|
1297
|
+
promise(const promise& __rhs);
|
1298
|
+
public:
|
1299
|
+
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
1300
|
+
~promise();
|
1301
|
+
|
1302
|
+
// assignment
|
1303
|
+
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
1304
|
+
_LIBCPP_INLINE_VISIBILITY
|
1305
|
+
promise& operator=(promise&& __rhs) _NOEXCEPT
|
1306
|
+
{
|
1307
|
+
promise(std::move(__rhs)).swap(*this);
|
1308
|
+
return *this;
|
1309
|
+
}
|
1310
|
+
promise& operator=(const promise& __rhs) = delete;
|
1311
|
+
#else // _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
1312
|
+
private:
|
1313
|
+
promise& operator=(const promise& __rhs);
|
1314
|
+
public:
|
1315
|
+
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
1316
|
+
_LIBCPP_INLINE_VISIBILITY
|
1317
|
+
void swap(promise& __rhs) _NOEXCEPT {_VSTD::swap(__state_, __rhs.__state_);}
|
1318
|
+
|
1319
|
+
// retrieving the result
|
1320
|
+
future<_Rp> get_future();
|
1321
|
+
|
1322
|
+
// setting the result
|
1323
|
+
void set_value(const _Rp& __r);
|
1324
|
+
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
1325
|
+
void set_value(_Rp&& __r);
|
1326
|
+
#endif
|
1327
|
+
void set_exception(exception_ptr __p);
|
1328
|
+
|
1329
|
+
// setting the result with deferred notification
|
1330
|
+
void set_value_at_thread_exit(const _Rp& __r);
|
1331
|
+
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
1332
|
+
void set_value_at_thread_exit(_Rp&& __r);
|
1333
|
+
#endif
|
1334
|
+
void set_exception_at_thread_exit(exception_ptr __p);
|
1335
|
+
};
|
1336
|
+
|
1337
|
+
template <class _Rp>
|
1338
|
+
promise<_Rp>::promise()
|
1339
|
+
: __state_(new __assoc_state<_Rp>)
|
1340
|
+
{
|
1341
|
+
}
|
1342
|
+
|
1343
|
+
template <class _Rp>
|
1344
|
+
template <class _Alloc>
|
1345
|
+
promise<_Rp>::promise(allocator_arg_t, const _Alloc& __a0)
|
1346
|
+
{
|
1347
|
+
typedef typename _Alloc::template rebind<__assoc_state_alloc<_Rp, _Alloc> >::other _A2;
|
1348
|
+
typedef __allocator_destructor<_A2> _D2;
|
1349
|
+
_A2 __a(__a0);
|
1350
|
+
unique_ptr<__assoc_state_alloc<_Rp, _Alloc>, _D2> __hold(__a.allocate(1), _D2(__a, 1));
|
1351
|
+
::new(__hold.get()) __assoc_state_alloc<_Rp, _Alloc>(__a0);
|
1352
|
+
__state_ = __hold.release();
|
1353
|
+
}
|
1354
|
+
|
1355
|
+
template <class _Rp>
|
1356
|
+
promise<_Rp>::~promise()
|
1357
|
+
{
|
1358
|
+
if (__state_)
|
1359
|
+
{
|
1360
|
+
if (!__state_->__has_value() && __state_->use_count() > 1)
|
1361
|
+
__state_->set_exception(make_exception_ptr(
|
1362
|
+
future_error(make_error_code(future_errc::broken_promise))
|
1363
|
+
));
|
1364
|
+
__state_->__release_shared();
|
1365
|
+
}
|
1366
|
+
}
|
1367
|
+
|
1368
|
+
template <class _Rp>
|
1369
|
+
future<_Rp>
|
1370
|
+
promise<_Rp>::get_future()
|
1371
|
+
{
|
1372
|
+
#ifndef _LIBCPP_NO_EXCEPTIONS
|
1373
|
+
if (__state_ == nullptr)
|
1374
|
+
throw future_error(make_error_code(future_errc::no_state));
|
1375
|
+
#endif
|
1376
|
+
return future<_Rp>(__state_);
|
1377
|
+
}
|
1378
|
+
|
1379
|
+
template <class _Rp>
|
1380
|
+
void
|
1381
|
+
promise<_Rp>::set_value(const _Rp& __r)
|
1382
|
+
{
|
1383
|
+
#ifndef _LIBCPP_NO_EXCEPTIONS
|
1384
|
+
if (__state_ == nullptr)
|
1385
|
+
throw future_error(make_error_code(future_errc::no_state));
|
1386
|
+
#endif
|
1387
|
+
__state_->set_value(__r);
|
1388
|
+
}
|
1389
|
+
|
1390
|
+
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
1391
|
+
|
1392
|
+
template <class _Rp>
|
1393
|
+
void
|
1394
|
+
promise<_Rp>::set_value(_Rp&& __r)
|
1395
|
+
{
|
1396
|
+
#ifndef _LIBCPP_NO_EXCEPTIONS
|
1397
|
+
if (__state_ == nullptr)
|
1398
|
+
throw future_error(make_error_code(future_errc::no_state));
|
1399
|
+
#endif
|
1400
|
+
__state_->set_value(_VSTD::move(__r));
|
1401
|
+
}
|
1402
|
+
|
1403
|
+
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
1404
|
+
|
1405
|
+
template <class _Rp>
|
1406
|
+
void
|
1407
|
+
promise<_Rp>::set_exception(exception_ptr __p)
|
1408
|
+
{
|
1409
|
+
#ifndef _LIBCPP_NO_EXCEPTIONS
|
1410
|
+
if (__state_ == nullptr)
|
1411
|
+
throw future_error(make_error_code(future_errc::no_state));
|
1412
|
+
#endif
|
1413
|
+
__state_->set_exception(__p);
|
1414
|
+
}
|
1415
|
+
|
1416
|
+
template <class _Rp>
|
1417
|
+
void
|
1418
|
+
promise<_Rp>::set_value_at_thread_exit(const _Rp& __r)
|
1419
|
+
{
|
1420
|
+
#ifndef _LIBCPP_NO_EXCEPTIONS
|
1421
|
+
if (__state_ == nullptr)
|
1422
|
+
throw future_error(make_error_code(future_errc::no_state));
|
1423
|
+
#endif
|
1424
|
+
__state_->set_value_at_thread_exit(__r);
|
1425
|
+
}
|
1426
|
+
|
1427
|
+
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
1428
|
+
|
1429
|
+
template <class _Rp>
|
1430
|
+
void
|
1431
|
+
promise<_Rp>::set_value_at_thread_exit(_Rp&& __r)
|
1432
|
+
{
|
1433
|
+
#ifndef _LIBCPP_NO_EXCEPTIONS
|
1434
|
+
if (__state_ == nullptr)
|
1435
|
+
throw future_error(make_error_code(future_errc::no_state));
|
1436
|
+
#endif
|
1437
|
+
__state_->set_value_at_thread_exit(_VSTD::move(__r));
|
1438
|
+
}
|
1439
|
+
|
1440
|
+
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
1441
|
+
|
1442
|
+
template <class _Rp>
|
1443
|
+
void
|
1444
|
+
promise<_Rp>::set_exception_at_thread_exit(exception_ptr __p)
|
1445
|
+
{
|
1446
|
+
#ifndef _LIBCPP_NO_EXCEPTIONS
|
1447
|
+
if (__state_ == nullptr)
|
1448
|
+
throw future_error(make_error_code(future_errc::no_state));
|
1449
|
+
#endif
|
1450
|
+
__state_->set_exception_at_thread_exit(__p);
|
1451
|
+
}
|
1452
|
+
|
1453
|
+
// promise<R&>
|
1454
|
+
|
1455
|
+
template <class _Rp>
|
1456
|
+
class _LIBCPP_TYPE_VIS promise<_Rp&>
|
1457
|
+
{
|
1458
|
+
__assoc_state<_Rp&>* __state_;
|
1459
|
+
|
1460
|
+
_LIBCPP_INLINE_VISIBILITY
|
1461
|
+
explicit promise(nullptr_t) _NOEXCEPT : __state_(nullptr) {}
|
1462
|
+
|
1463
|
+
template <class> friend class packaged_task;
|
1464
|
+
|
1465
|
+
public:
|
1466
|
+
promise();
|
1467
|
+
template <class _Allocator>
|
1468
|
+
promise(allocator_arg_t, const _Allocator& __a);
|
1469
|
+
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
1470
|
+
_LIBCPP_INLINE_VISIBILITY
|
1471
|
+
promise(promise&& __rhs) _NOEXCEPT
|
1472
|
+
: __state_(__rhs.__state_) {__rhs.__state_ = nullptr;}
|
1473
|
+
promise(const promise& __rhs) = delete;
|
1474
|
+
#else // _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
1475
|
+
private:
|
1476
|
+
promise(const promise& __rhs);
|
1477
|
+
public:
|
1478
|
+
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
1479
|
+
~promise();
|
1480
|
+
|
1481
|
+
// assignment
|
1482
|
+
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
1483
|
+
_LIBCPP_INLINE_VISIBILITY
|
1484
|
+
promise& operator=(promise&& __rhs) _NOEXCEPT
|
1485
|
+
{
|
1486
|
+
promise(std::move(__rhs)).swap(*this);
|
1487
|
+
return *this;
|
1488
|
+
}
|
1489
|
+
promise& operator=(const promise& __rhs) = delete;
|
1490
|
+
#else // _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
1491
|
+
private:
|
1492
|
+
promise& operator=(const promise& __rhs);
|
1493
|
+
public:
|
1494
|
+
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
1495
|
+
_LIBCPP_INLINE_VISIBILITY
|
1496
|
+
void swap(promise& __rhs) _NOEXCEPT {_VSTD::swap(__state_, __rhs.__state_);}
|
1497
|
+
|
1498
|
+
// retrieving the result
|
1499
|
+
future<_Rp&> get_future();
|
1500
|
+
|
1501
|
+
// setting the result
|
1502
|
+
void set_value(_Rp& __r);
|
1503
|
+
void set_exception(exception_ptr __p);
|
1504
|
+
|
1505
|
+
// setting the result with deferred notification
|
1506
|
+
void set_value_at_thread_exit(_Rp&);
|
1507
|
+
void set_exception_at_thread_exit(exception_ptr __p);
|
1508
|
+
};
|
1509
|
+
|
1510
|
+
template <class _Rp>
|
1511
|
+
promise<_Rp&>::promise()
|
1512
|
+
: __state_(new __assoc_state<_Rp&>)
|
1513
|
+
{
|
1514
|
+
}
|
1515
|
+
|
1516
|
+
template <class _Rp>
|
1517
|
+
template <class _Alloc>
|
1518
|
+
promise<_Rp&>::promise(allocator_arg_t, const _Alloc& __a0)
|
1519
|
+
{
|
1520
|
+
typedef typename _Alloc::template rebind<__assoc_state_alloc<_Rp&, _Alloc> >::other _A2;
|
1521
|
+
typedef __allocator_destructor<_A2> _D2;
|
1522
|
+
_A2 __a(__a0);
|
1523
|
+
unique_ptr<__assoc_state_alloc<_Rp&, _Alloc>, _D2> __hold(__a.allocate(1), _D2(__a, 1));
|
1524
|
+
::new(__hold.get()) __assoc_state_alloc<_Rp&, _Alloc>(__a0);
|
1525
|
+
__state_ = __hold.release();
|
1526
|
+
}
|
1527
|
+
|
1528
|
+
template <class _Rp>
|
1529
|
+
promise<_Rp&>::~promise()
|
1530
|
+
{
|
1531
|
+
if (__state_)
|
1532
|
+
{
|
1533
|
+
if (!__state_->__has_value() && __state_->use_count() > 1)
|
1534
|
+
__state_->set_exception(make_exception_ptr(
|
1535
|
+
future_error(make_error_code(future_errc::broken_promise))
|
1536
|
+
));
|
1537
|
+
__state_->__release_shared();
|
1538
|
+
}
|
1539
|
+
}
|
1540
|
+
|
1541
|
+
template <class _Rp>
|
1542
|
+
future<_Rp&>
|
1543
|
+
promise<_Rp&>::get_future()
|
1544
|
+
{
|
1545
|
+
#ifndef _LIBCPP_NO_EXCEPTIONS
|
1546
|
+
if (__state_ == nullptr)
|
1547
|
+
throw future_error(make_error_code(future_errc::no_state));
|
1548
|
+
#endif
|
1549
|
+
return future<_Rp&>(__state_);
|
1550
|
+
}
|
1551
|
+
|
1552
|
+
template <class _Rp>
|
1553
|
+
void
|
1554
|
+
promise<_Rp&>::set_value(_Rp& __r)
|
1555
|
+
{
|
1556
|
+
#ifndef _LIBCPP_NO_EXCEPTIONS
|
1557
|
+
if (__state_ == nullptr)
|
1558
|
+
throw future_error(make_error_code(future_errc::no_state));
|
1559
|
+
#endif
|
1560
|
+
__state_->set_value(__r);
|
1561
|
+
}
|
1562
|
+
|
1563
|
+
template <class _Rp>
|
1564
|
+
void
|
1565
|
+
promise<_Rp&>::set_exception(exception_ptr __p)
|
1566
|
+
{
|
1567
|
+
#ifndef _LIBCPP_NO_EXCEPTIONS
|
1568
|
+
if (__state_ == nullptr)
|
1569
|
+
throw future_error(make_error_code(future_errc::no_state));
|
1570
|
+
#endif
|
1571
|
+
__state_->set_exception(__p);
|
1572
|
+
}
|
1573
|
+
|
1574
|
+
template <class _Rp>
|
1575
|
+
void
|
1576
|
+
promise<_Rp&>::set_value_at_thread_exit(_Rp& __r)
|
1577
|
+
{
|
1578
|
+
#ifndef _LIBCPP_NO_EXCEPTIONS
|
1579
|
+
if (__state_ == nullptr)
|
1580
|
+
throw future_error(make_error_code(future_errc::no_state));
|
1581
|
+
#endif
|
1582
|
+
__state_->set_value_at_thread_exit(__r);
|
1583
|
+
}
|
1584
|
+
|
1585
|
+
template <class _Rp>
|
1586
|
+
void
|
1587
|
+
promise<_Rp&>::set_exception_at_thread_exit(exception_ptr __p)
|
1588
|
+
{
|
1589
|
+
#ifndef _LIBCPP_NO_EXCEPTIONS
|
1590
|
+
if (__state_ == nullptr)
|
1591
|
+
throw future_error(make_error_code(future_errc::no_state));
|
1592
|
+
#endif
|
1593
|
+
__state_->set_exception_at_thread_exit(__p);
|
1594
|
+
}
|
1595
|
+
|
1596
|
+
// promise<void>
|
1597
|
+
|
1598
|
+
template <>
|
1599
|
+
class _LIBCPP_TYPE_VIS promise<void>
|
1600
|
+
{
|
1601
|
+
__assoc_sub_state* __state_;
|
1602
|
+
|
1603
|
+
_LIBCPP_INLINE_VISIBILITY
|
1604
|
+
explicit promise(nullptr_t) _NOEXCEPT : __state_(nullptr) {}
|
1605
|
+
|
1606
|
+
template <class> friend class packaged_task;
|
1607
|
+
|
1608
|
+
public:
|
1609
|
+
promise();
|
1610
|
+
template <class _Allocator>
|
1611
|
+
promise(allocator_arg_t, const _Allocator& __a);
|
1612
|
+
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
1613
|
+
_LIBCPP_INLINE_VISIBILITY
|
1614
|
+
promise(promise&& __rhs) _NOEXCEPT
|
1615
|
+
: __state_(__rhs.__state_) {__rhs.__state_ = nullptr;}
|
1616
|
+
promise(const promise& __rhs) = delete;
|
1617
|
+
#else // _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
1618
|
+
private:
|
1619
|
+
promise(const promise& __rhs);
|
1620
|
+
public:
|
1621
|
+
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
1622
|
+
~promise();
|
1623
|
+
|
1624
|
+
// assignment
|
1625
|
+
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
1626
|
+
_LIBCPP_INLINE_VISIBILITY
|
1627
|
+
promise& operator=(promise&& __rhs) _NOEXCEPT
|
1628
|
+
{
|
1629
|
+
promise(std::move(__rhs)).swap(*this);
|
1630
|
+
return *this;
|
1631
|
+
}
|
1632
|
+
promise& operator=(const promise& __rhs) = delete;
|
1633
|
+
#else // _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
1634
|
+
private:
|
1635
|
+
promise& operator=(const promise& __rhs);
|
1636
|
+
public:
|
1637
|
+
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
1638
|
+
_LIBCPP_INLINE_VISIBILITY
|
1639
|
+
void swap(promise& __rhs) _NOEXCEPT {_VSTD::swap(__state_, __rhs.__state_);}
|
1640
|
+
|
1641
|
+
// retrieving the result
|
1642
|
+
future<void> get_future();
|
1643
|
+
|
1644
|
+
// setting the result
|
1645
|
+
void set_value();
|
1646
|
+
void set_exception(exception_ptr __p);
|
1647
|
+
|
1648
|
+
// setting the result with deferred notification
|
1649
|
+
void set_value_at_thread_exit();
|
1650
|
+
void set_exception_at_thread_exit(exception_ptr __p);
|
1651
|
+
};
|
1652
|
+
|
1653
|
+
template <class _Alloc>
|
1654
|
+
promise<void>::promise(allocator_arg_t, const _Alloc& __a0)
|
1655
|
+
{
|
1656
|
+
typedef typename _Alloc::template rebind<__assoc_sub_state_alloc<_Alloc> >::other _A2;
|
1657
|
+
typedef __allocator_destructor<_A2> _D2;
|
1658
|
+
_A2 __a(__a0);
|
1659
|
+
unique_ptr<__assoc_sub_state_alloc<_Alloc>, _D2> __hold(__a.allocate(1), _D2(__a, 1));
|
1660
|
+
::new(__hold.get()) __assoc_sub_state_alloc<_Alloc>(__a0);
|
1661
|
+
__state_ = __hold.release();
|
1662
|
+
}
|
1663
|
+
|
1664
|
+
template <class _Rp>
|
1665
|
+
inline _LIBCPP_INLINE_VISIBILITY
|
1666
|
+
void
|
1667
|
+
swap(promise<_Rp>& __x, promise<_Rp>& __y) _NOEXCEPT
|
1668
|
+
{
|
1669
|
+
__x.swap(__y);
|
1670
|
+
}
|
1671
|
+
|
1672
|
+
template <class _Rp, class _Alloc>
|
1673
|
+
struct _LIBCPP_TYPE_VIS uses_allocator<promise<_Rp>, _Alloc>
|
1674
|
+
: public true_type {};
|
1675
|
+
|
1676
|
+
#ifndef _LIBCPP_HAS_NO_VARIADICS
|
1677
|
+
|
1678
|
+
// packaged_task
|
1679
|
+
|
1680
|
+
template<class _Fp> class __packaged_task_base;
|
1681
|
+
|
1682
|
+
template<class _Rp, class ..._ArgTypes>
|
1683
|
+
class __packaged_task_base<_Rp(_ArgTypes...)>
|
1684
|
+
{
|
1685
|
+
__packaged_task_base(const __packaged_task_base&);
|
1686
|
+
__packaged_task_base& operator=(const __packaged_task_base&);
|
1687
|
+
public:
|
1688
|
+
_LIBCPP_INLINE_VISIBILITY
|
1689
|
+
__packaged_task_base() {}
|
1690
|
+
_LIBCPP_INLINE_VISIBILITY
|
1691
|
+
virtual ~__packaged_task_base() {}
|
1692
|
+
virtual void __move_to(__packaged_task_base*) _NOEXCEPT = 0;
|
1693
|
+
virtual void destroy() = 0;
|
1694
|
+
virtual void destroy_deallocate() = 0;
|
1695
|
+
virtual _Rp operator()(_ArgTypes&& ...) = 0;
|
1696
|
+
};
|
1697
|
+
|
1698
|
+
template<class _FD, class _Alloc, class _FB> class __packaged_task_func;
|
1699
|
+
|
1700
|
+
template<class _Fp, class _Alloc, class _Rp, class ..._ArgTypes>
|
1701
|
+
class __packaged_task_func<_Fp, _Alloc, _Rp(_ArgTypes...)>
|
1702
|
+
: public __packaged_task_base<_Rp(_ArgTypes...)>
|
1703
|
+
{
|
1704
|
+
__compressed_pair<_Fp, _Alloc> __f_;
|
1705
|
+
public:
|
1706
|
+
_LIBCPP_INLINE_VISIBILITY
|
1707
|
+
explicit __packaged_task_func(const _Fp& __f) : __f_(__f) {}
|
1708
|
+
_LIBCPP_INLINE_VISIBILITY
|
1709
|
+
explicit __packaged_task_func(_Fp&& __f) : __f_(_VSTD::move(__f)) {}
|
1710
|
+
_LIBCPP_INLINE_VISIBILITY
|
1711
|
+
__packaged_task_func(const _Fp& __f, const _Alloc& __a)
|
1712
|
+
: __f_(__f, __a) {}
|
1713
|
+
_LIBCPP_INLINE_VISIBILITY
|
1714
|
+
__packaged_task_func(_Fp&& __f, const _Alloc& __a)
|
1715
|
+
: __f_(_VSTD::move(__f), __a) {}
|
1716
|
+
virtual void __move_to(__packaged_task_base<_Rp(_ArgTypes...)>*) _NOEXCEPT;
|
1717
|
+
virtual void destroy();
|
1718
|
+
virtual void destroy_deallocate();
|
1719
|
+
virtual _Rp operator()(_ArgTypes&& ... __args);
|
1720
|
+
};
|
1721
|
+
|
1722
|
+
template<class _Fp, class _Alloc, class _Rp, class ..._ArgTypes>
|
1723
|
+
void
|
1724
|
+
__packaged_task_func<_Fp, _Alloc, _Rp(_ArgTypes...)>::__move_to(
|
1725
|
+
__packaged_task_base<_Rp(_ArgTypes...)>* __p) _NOEXCEPT
|
1726
|
+
{
|
1727
|
+
::new (__p) __packaged_task_func(_VSTD::move(__f_.first()), _VSTD::move(__f_.second()));
|
1728
|
+
}
|
1729
|
+
|
1730
|
+
template<class _Fp, class _Alloc, class _Rp, class ..._ArgTypes>
|
1731
|
+
void
|
1732
|
+
__packaged_task_func<_Fp, _Alloc, _Rp(_ArgTypes...)>::destroy()
|
1733
|
+
{
|
1734
|
+
__f_.~__compressed_pair<_Fp, _Alloc>();
|
1735
|
+
}
|
1736
|
+
|
1737
|
+
template<class _Fp, class _Alloc, class _Rp, class ..._ArgTypes>
|
1738
|
+
void
|
1739
|
+
__packaged_task_func<_Fp, _Alloc, _Rp(_ArgTypes...)>::destroy_deallocate()
|
1740
|
+
{
|
1741
|
+
typedef typename _Alloc::template rebind<__packaged_task_func>::other _Ap;
|
1742
|
+
_Ap __a(__f_.second());
|
1743
|
+
__f_.~__compressed_pair<_Fp, _Alloc>();
|
1744
|
+
__a.deallocate(this, 1);
|
1745
|
+
}
|
1746
|
+
|
1747
|
+
template<class _Fp, class _Alloc, class _Rp, class ..._ArgTypes>
|
1748
|
+
_Rp
|
1749
|
+
__packaged_task_func<_Fp, _Alloc, _Rp(_ArgTypes...)>::operator()(_ArgTypes&& ... __arg)
|
1750
|
+
{
|
1751
|
+
return __invoke(__f_.first(), _VSTD::forward<_ArgTypes>(__arg)...);
|
1752
|
+
}
|
1753
|
+
|
1754
|
+
template <class _Callable> class __packaged_task_function;
|
1755
|
+
|
1756
|
+
template<class _Rp, class ..._ArgTypes>
|
1757
|
+
class __packaged_task_function<_Rp(_ArgTypes...)>
|
1758
|
+
{
|
1759
|
+
typedef __packaged_task_base<_Rp(_ArgTypes...)> __base;
|
1760
|
+
typename aligned_storage<3*sizeof(void*)>::type __buf_;
|
1761
|
+
__base* __f_;
|
1762
|
+
|
1763
|
+
public:
|
1764
|
+
typedef _Rp result_type;
|
1765
|
+
|
1766
|
+
// construct/copy/destroy:
|
1767
|
+
_LIBCPP_INLINE_VISIBILITY
|
1768
|
+
__packaged_task_function() _NOEXCEPT : __f_(nullptr) {}
|
1769
|
+
template<class _Fp>
|
1770
|
+
__packaged_task_function(_Fp&& __f);
|
1771
|
+
template<class _Fp, class _Alloc>
|
1772
|
+
__packaged_task_function(allocator_arg_t, const _Alloc& __a, _Fp&& __f);
|
1773
|
+
|
1774
|
+
__packaged_task_function(__packaged_task_function&&) _NOEXCEPT;
|
1775
|
+
__packaged_task_function& operator=(__packaged_task_function&&) _NOEXCEPT;
|
1776
|
+
|
1777
|
+
__packaged_task_function(const __packaged_task_function&) = delete;
|
1778
|
+
__packaged_task_function& operator=(const __packaged_task_function&) = delete;
|
1779
|
+
|
1780
|
+
~__packaged_task_function();
|
1781
|
+
|
1782
|
+
void swap(__packaged_task_function&) _NOEXCEPT;
|
1783
|
+
|
1784
|
+
_Rp operator()(_ArgTypes...) const;
|
1785
|
+
};
|
1786
|
+
|
1787
|
+
template<class _Rp, class ..._ArgTypes>
|
1788
|
+
__packaged_task_function<_Rp(_ArgTypes...)>::__packaged_task_function(__packaged_task_function&& __f) _NOEXCEPT
|
1789
|
+
{
|
1790
|
+
if (__f.__f_ == nullptr)
|
1791
|
+
__f_ = nullptr;
|
1792
|
+
else if (__f.__f_ == (__base*)&__f.__buf_)
|
1793
|
+
{
|
1794
|
+
__f_ = (__base*)&__buf_;
|
1795
|
+
__f.__f_->__move_to(__f_);
|
1796
|
+
}
|
1797
|
+
else
|
1798
|
+
{
|
1799
|
+
__f_ = __f.__f_;
|
1800
|
+
__f.__f_ = nullptr;
|
1801
|
+
}
|
1802
|
+
}
|
1803
|
+
|
1804
|
+
template<class _Rp, class ..._ArgTypes>
|
1805
|
+
template <class _Fp>
|
1806
|
+
__packaged_task_function<_Rp(_ArgTypes...)>::__packaged_task_function(_Fp&& __f)
|
1807
|
+
: __f_(nullptr)
|
1808
|
+
{
|
1809
|
+
typedef typename remove_reference<_Fp>::type _FR;
|
1810
|
+
typedef __packaged_task_func<_FR, allocator<_FR>, _Rp(_ArgTypes...)> _FF;
|
1811
|
+
if (sizeof(_FF) <= sizeof(__buf_))
|
1812
|
+
{
|
1813
|
+
__f_ = (__base*)&__buf_;
|
1814
|
+
::new (__f_) _FF(_VSTD::forward<_Fp>(__f));
|
1815
|
+
}
|
1816
|
+
else
|
1817
|
+
{
|
1818
|
+
typedef allocator<_FF> _Ap;
|
1819
|
+
_Ap __a;
|
1820
|
+
typedef __allocator_destructor<_Ap> _Dp;
|
1821
|
+
unique_ptr<__base, _Dp> __hold(__a.allocate(1), _Dp(__a, 1));
|
1822
|
+
::new (__hold.get()) _FF(_VSTD::forward<_Fp>(__f), allocator<_FR>(__a));
|
1823
|
+
__f_ = __hold.release();
|
1824
|
+
}
|
1825
|
+
}
|
1826
|
+
|
1827
|
+
template<class _Rp, class ..._ArgTypes>
|
1828
|
+
template <class _Fp, class _Alloc>
|
1829
|
+
__packaged_task_function<_Rp(_ArgTypes...)>::__packaged_task_function(
|
1830
|
+
allocator_arg_t, const _Alloc& __a0, _Fp&& __f)
|
1831
|
+
: __f_(nullptr)
|
1832
|
+
{
|
1833
|
+
typedef allocator_traits<_Alloc> __alloc_traits;
|
1834
|
+
typedef typename remove_reference<_Fp>::type _FR;
|
1835
|
+
typedef __packaged_task_func<_FR, _Alloc, _Rp(_ArgTypes...)> _FF;
|
1836
|
+
if (sizeof(_FF) <= sizeof(__buf_))
|
1837
|
+
{
|
1838
|
+
__f_ = (__base*)&__buf_;
|
1839
|
+
::new (__f_) _FF(_VSTD::forward<_Fp>(__f));
|
1840
|
+
}
|
1841
|
+
else
|
1842
|
+
{
|
1843
|
+
typedef typename __alloc_traits::template
|
1844
|
+
#ifndef _LIBCPP_HAS_NO_TEMPLATE_ALIASES
|
1845
|
+
rebind_alloc<_FF>
|
1846
|
+
#else
|
1847
|
+
rebind_alloc<_FF>::other
|
1848
|
+
#endif
|
1849
|
+
_Ap;
|
1850
|
+
_Ap __a(__a0);
|
1851
|
+
typedef __allocator_destructor<_Ap> _Dp;
|
1852
|
+
unique_ptr<__base, _Dp> __hold(__a.allocate(1), _Dp(__a, 1));
|
1853
|
+
::new (__hold.get()) _FF(_VSTD::forward<_Fp>(__f), _Alloc(__a));
|
1854
|
+
__f_ = __hold.release();
|
1855
|
+
}
|
1856
|
+
}
|
1857
|
+
|
1858
|
+
template<class _Rp, class ..._ArgTypes>
|
1859
|
+
__packaged_task_function<_Rp(_ArgTypes...)>&
|
1860
|
+
__packaged_task_function<_Rp(_ArgTypes...)>::operator=(__packaged_task_function&& __f) _NOEXCEPT
|
1861
|
+
{
|
1862
|
+
if (__f_ == (__base*)&__buf_)
|
1863
|
+
__f_->destroy();
|
1864
|
+
else if (__f_)
|
1865
|
+
__f_->destroy_deallocate();
|
1866
|
+
__f_ = nullptr;
|
1867
|
+
if (__f.__f_ == nullptr)
|
1868
|
+
__f_ = nullptr;
|
1869
|
+
else if (__f.__f_ == (__base*)&__f.__buf_)
|
1870
|
+
{
|
1871
|
+
__f_ = (__base*)&__buf_;
|
1872
|
+
__f.__f_->__move_to(__f_);
|
1873
|
+
}
|
1874
|
+
else
|
1875
|
+
{
|
1876
|
+
__f_ = __f.__f_;
|
1877
|
+
__f.__f_ = nullptr;
|
1878
|
+
}
|
1879
|
+
return *this;
|
1880
|
+
}
|
1881
|
+
|
1882
|
+
template<class _Rp, class ..._ArgTypes>
|
1883
|
+
__packaged_task_function<_Rp(_ArgTypes...)>::~__packaged_task_function()
|
1884
|
+
{
|
1885
|
+
if (__f_ == (__base*)&__buf_)
|
1886
|
+
__f_->destroy();
|
1887
|
+
else if (__f_)
|
1888
|
+
__f_->destroy_deallocate();
|
1889
|
+
}
|
1890
|
+
|
1891
|
+
template<class _Rp, class ..._ArgTypes>
|
1892
|
+
void
|
1893
|
+
__packaged_task_function<_Rp(_ArgTypes...)>::swap(__packaged_task_function& __f) _NOEXCEPT
|
1894
|
+
{
|
1895
|
+
if (__f_ == (__base*)&__buf_ && __f.__f_ == (__base*)&__f.__buf_)
|
1896
|
+
{
|
1897
|
+
typename aligned_storage<sizeof(__buf_)>::type __tempbuf;
|
1898
|
+
__base* __t = (__base*)&__tempbuf;
|
1899
|
+
__f_->__move_to(__t);
|
1900
|
+
__f_->destroy();
|
1901
|
+
__f_ = nullptr;
|
1902
|
+
__f.__f_->__move_to((__base*)&__buf_);
|
1903
|
+
__f.__f_->destroy();
|
1904
|
+
__f.__f_ = nullptr;
|
1905
|
+
__f_ = (__base*)&__buf_;
|
1906
|
+
__t->__move_to((__base*)&__f.__buf_);
|
1907
|
+
__t->destroy();
|
1908
|
+
__f.__f_ = (__base*)&__f.__buf_;
|
1909
|
+
}
|
1910
|
+
else if (__f_ == (__base*)&__buf_)
|
1911
|
+
{
|
1912
|
+
__f_->__move_to((__base*)&__f.__buf_);
|
1913
|
+
__f_->destroy();
|
1914
|
+
__f_ = __f.__f_;
|
1915
|
+
__f.__f_ = (__base*)&__f.__buf_;
|
1916
|
+
}
|
1917
|
+
else if (__f.__f_ == (__base*)&__f.__buf_)
|
1918
|
+
{
|
1919
|
+
__f.__f_->__move_to((__base*)&__buf_);
|
1920
|
+
__f.__f_->destroy();
|
1921
|
+
__f.__f_ = __f_;
|
1922
|
+
__f_ = (__base*)&__buf_;
|
1923
|
+
}
|
1924
|
+
else
|
1925
|
+
_VSTD::swap(__f_, __f.__f_);
|
1926
|
+
}
|
1927
|
+
|
1928
|
+
template<class _Rp, class ..._ArgTypes>
|
1929
|
+
inline _LIBCPP_INLINE_VISIBILITY
|
1930
|
+
_Rp
|
1931
|
+
__packaged_task_function<_Rp(_ArgTypes...)>::operator()(_ArgTypes... __arg) const
|
1932
|
+
{
|
1933
|
+
return (*__f_)(_VSTD::forward<_ArgTypes>(__arg)...);
|
1934
|
+
}
|
1935
|
+
|
1936
|
+
template<class _Rp, class ..._ArgTypes>
|
1937
|
+
class _LIBCPP_TYPE_VIS packaged_task<_Rp(_ArgTypes...)>
|
1938
|
+
{
|
1939
|
+
public:
|
1940
|
+
typedef _Rp result_type;
|
1941
|
+
|
1942
|
+
private:
|
1943
|
+
__packaged_task_function<result_type(_ArgTypes...)> __f_;
|
1944
|
+
promise<result_type> __p_;
|
1945
|
+
|
1946
|
+
public:
|
1947
|
+
// construction and destruction
|
1948
|
+
_LIBCPP_INLINE_VISIBILITY
|
1949
|
+
packaged_task() _NOEXCEPT : __p_(nullptr) {}
|
1950
|
+
template <class _Fp>
|
1951
|
+
_LIBCPP_INLINE_VISIBILITY
|
1952
|
+
explicit packaged_task(_Fp&& __f) : __f_(_VSTD::forward<_Fp>(__f)) {}
|
1953
|
+
template <class _Fp, class _Allocator>
|
1954
|
+
_LIBCPP_INLINE_VISIBILITY
|
1955
|
+
explicit packaged_task(allocator_arg_t, const _Allocator& __a, _Fp&& __f)
|
1956
|
+
: __f_(allocator_arg, __a, _VSTD::forward<_Fp>(__f)),
|
1957
|
+
__p_(allocator_arg, __a) {}
|
1958
|
+
// ~packaged_task() = default;
|
1959
|
+
|
1960
|
+
// no copy
|
1961
|
+
packaged_task(const packaged_task&) = delete;
|
1962
|
+
packaged_task& operator=(const packaged_task&) = delete;
|
1963
|
+
|
1964
|
+
// move support
|
1965
|
+
_LIBCPP_INLINE_VISIBILITY
|
1966
|
+
packaged_task(packaged_task&& __other) _NOEXCEPT
|
1967
|
+
: __f_(_VSTD::move(__other.__f_)), __p_(_VSTD::move(__other.__p_)) {}
|
1968
|
+
_LIBCPP_INLINE_VISIBILITY
|
1969
|
+
packaged_task& operator=(packaged_task&& __other) _NOEXCEPT
|
1970
|
+
{
|
1971
|
+
__f_ = _VSTD::move(__other.__f_);
|
1972
|
+
__p_ = _VSTD::move(__other.__p_);
|
1973
|
+
return *this;
|
1974
|
+
}
|
1975
|
+
_LIBCPP_INLINE_VISIBILITY
|
1976
|
+
void swap(packaged_task& __other) _NOEXCEPT
|
1977
|
+
{
|
1978
|
+
__f_.swap(__other.__f_);
|
1979
|
+
__p_.swap(__other.__p_);
|
1980
|
+
}
|
1981
|
+
|
1982
|
+
_LIBCPP_INLINE_VISIBILITY
|
1983
|
+
bool valid() const _NOEXCEPT {return __p_.__state_ != nullptr;}
|
1984
|
+
|
1985
|
+
// result retrieval
|
1986
|
+
_LIBCPP_INLINE_VISIBILITY
|
1987
|
+
future<result_type> get_future() {return __p_.get_future();}
|
1988
|
+
|
1989
|
+
// execution
|
1990
|
+
void operator()(_ArgTypes... __args);
|
1991
|
+
void make_ready_at_thread_exit(_ArgTypes... __args);
|
1992
|
+
|
1993
|
+
void reset();
|
1994
|
+
};
|
1995
|
+
|
1996
|
+
template<class _Rp, class ..._ArgTypes>
|
1997
|
+
void
|
1998
|
+
packaged_task<_Rp(_ArgTypes...)>::operator()(_ArgTypes... __args)
|
1999
|
+
{
|
2000
|
+
#ifndef _LIBCPP_NO_EXCEPTIONS
|
2001
|
+
if (__p_.__state_ == nullptr)
|
2002
|
+
throw future_error(make_error_code(future_errc::no_state));
|
2003
|
+
if (__p_.__state_->__has_value())
|
2004
|
+
throw future_error(make_error_code(future_errc::promise_already_satisfied));
|
2005
|
+
try
|
2006
|
+
{
|
2007
|
+
#endif // _LIBCPP_NO_EXCEPTIONS
|
2008
|
+
__p_.set_value(__f_(_VSTD::forward<_ArgTypes>(__args)...));
|
2009
|
+
#ifndef _LIBCPP_NO_EXCEPTIONS
|
2010
|
+
}
|
2011
|
+
catch (...)
|
2012
|
+
{
|
2013
|
+
__p_.set_exception(current_exception());
|
2014
|
+
}
|
2015
|
+
#endif // _LIBCPP_NO_EXCEPTIONS
|
2016
|
+
}
|
2017
|
+
|
2018
|
+
template<class _Rp, class ..._ArgTypes>
|
2019
|
+
void
|
2020
|
+
packaged_task<_Rp(_ArgTypes...)>::make_ready_at_thread_exit(_ArgTypes... __args)
|
2021
|
+
{
|
2022
|
+
#ifndef _LIBCPP_NO_EXCEPTIONS
|
2023
|
+
if (__p_.__state_ == nullptr)
|
2024
|
+
throw future_error(make_error_code(future_errc::no_state));
|
2025
|
+
if (__p_.__state_->__has_value())
|
2026
|
+
throw future_error(make_error_code(future_errc::promise_already_satisfied));
|
2027
|
+
try
|
2028
|
+
{
|
2029
|
+
#endif // _LIBCPP_NO_EXCEPTIONS
|
2030
|
+
__p_.set_value_at_thread_exit(__f_(_VSTD::forward<_ArgTypes>(__args)...));
|
2031
|
+
#ifndef _LIBCPP_NO_EXCEPTIONS
|
2032
|
+
}
|
2033
|
+
catch (...)
|
2034
|
+
{
|
2035
|
+
__p_.set_exception_at_thread_exit(current_exception());
|
2036
|
+
}
|
2037
|
+
#endif // _LIBCPP_NO_EXCEPTIONS
|
2038
|
+
}
|
2039
|
+
|
2040
|
+
template<class _Rp, class ..._ArgTypes>
|
2041
|
+
void
|
2042
|
+
packaged_task<_Rp(_ArgTypes...)>::reset()
|
2043
|
+
{
|
2044
|
+
#ifndef _LIBCPP_NO_EXCEPTIONS
|
2045
|
+
if (!valid())
|
2046
|
+
throw future_error(make_error_code(future_errc::no_state));
|
2047
|
+
#endif // _LIBCPP_NO_EXCEPTIONS
|
2048
|
+
__p_ = promise<result_type>();
|
2049
|
+
}
|
2050
|
+
|
2051
|
+
template<class ..._ArgTypes>
|
2052
|
+
class _LIBCPP_TYPE_VIS packaged_task<void(_ArgTypes...)>
|
2053
|
+
{
|
2054
|
+
public:
|
2055
|
+
typedef void result_type;
|
2056
|
+
|
2057
|
+
private:
|
2058
|
+
__packaged_task_function<result_type(_ArgTypes...)> __f_;
|
2059
|
+
promise<result_type> __p_;
|
2060
|
+
|
2061
|
+
public:
|
2062
|
+
// construction and destruction
|
2063
|
+
_LIBCPP_INLINE_VISIBILITY
|
2064
|
+
packaged_task() _NOEXCEPT : __p_(nullptr) {}
|
2065
|
+
template <class _Fp>
|
2066
|
+
_LIBCPP_INLINE_VISIBILITY
|
2067
|
+
explicit packaged_task(_Fp&& __f) : __f_(_VSTD::forward<_Fp>(__f)) {}
|
2068
|
+
template <class _Fp, class _Allocator>
|
2069
|
+
_LIBCPP_INLINE_VISIBILITY
|
2070
|
+
explicit packaged_task(allocator_arg_t, const _Allocator& __a, _Fp&& __f)
|
2071
|
+
: __f_(allocator_arg, __a, _VSTD::forward<_Fp>(__f)),
|
2072
|
+
__p_(allocator_arg, __a) {}
|
2073
|
+
// ~packaged_task() = default;
|
2074
|
+
|
2075
|
+
// no copy
|
2076
|
+
packaged_task(const packaged_task&) = delete;
|
2077
|
+
packaged_task& operator=(const packaged_task&) = delete;
|
2078
|
+
|
2079
|
+
// move support
|
2080
|
+
_LIBCPP_INLINE_VISIBILITY
|
2081
|
+
packaged_task(packaged_task&& __other) _NOEXCEPT
|
2082
|
+
: __f_(_VSTD::move(__other.__f_)), __p_(_VSTD::move(__other.__p_)) {}
|
2083
|
+
_LIBCPP_INLINE_VISIBILITY
|
2084
|
+
packaged_task& operator=(packaged_task&& __other) _NOEXCEPT
|
2085
|
+
{
|
2086
|
+
__f_ = _VSTD::move(__other.__f_);
|
2087
|
+
__p_ = _VSTD::move(__other.__p_);
|
2088
|
+
return *this;
|
2089
|
+
}
|
2090
|
+
_LIBCPP_INLINE_VISIBILITY
|
2091
|
+
void swap(packaged_task& __other) _NOEXCEPT
|
2092
|
+
{
|
2093
|
+
__f_.swap(__other.__f_);
|
2094
|
+
__p_.swap(__other.__p_);
|
2095
|
+
}
|
2096
|
+
|
2097
|
+
_LIBCPP_INLINE_VISIBILITY
|
2098
|
+
bool valid() const _NOEXCEPT {return __p_.__state_ != nullptr;}
|
2099
|
+
|
2100
|
+
// result retrieval
|
2101
|
+
_LIBCPP_INLINE_VISIBILITY
|
2102
|
+
future<result_type> get_future() {return __p_.get_future();}
|
2103
|
+
|
2104
|
+
// execution
|
2105
|
+
void operator()(_ArgTypes... __args);
|
2106
|
+
void make_ready_at_thread_exit(_ArgTypes... __args);
|
2107
|
+
|
2108
|
+
void reset();
|
2109
|
+
};
|
2110
|
+
|
2111
|
+
template<class ..._ArgTypes>
|
2112
|
+
void
|
2113
|
+
packaged_task<void(_ArgTypes...)>::operator()(_ArgTypes... __args)
|
2114
|
+
{
|
2115
|
+
#ifndef _LIBCPP_NO_EXCEPTIONS
|
2116
|
+
if (__p_.__state_ == nullptr)
|
2117
|
+
throw future_error(make_error_code(future_errc::no_state));
|
2118
|
+
if (__p_.__state_->__has_value())
|
2119
|
+
throw future_error(make_error_code(future_errc::promise_already_satisfied));
|
2120
|
+
try
|
2121
|
+
{
|
2122
|
+
#endif // _LIBCPP_NO_EXCEPTIONS
|
2123
|
+
__f_(_VSTD::forward<_ArgTypes>(__args)...);
|
2124
|
+
__p_.set_value();
|
2125
|
+
#ifndef _LIBCPP_NO_EXCEPTIONS
|
2126
|
+
}
|
2127
|
+
catch (...)
|
2128
|
+
{
|
2129
|
+
__p_.set_exception(current_exception());
|
2130
|
+
}
|
2131
|
+
#endif // _LIBCPP_NO_EXCEPTIONS
|
2132
|
+
}
|
2133
|
+
|
2134
|
+
template<class ..._ArgTypes>
|
2135
|
+
void
|
2136
|
+
packaged_task<void(_ArgTypes...)>::make_ready_at_thread_exit(_ArgTypes... __args)
|
2137
|
+
{
|
2138
|
+
#ifndef _LIBCPP_NO_EXCEPTIONS
|
2139
|
+
if (__p_.__state_ == nullptr)
|
2140
|
+
throw future_error(make_error_code(future_errc::no_state));
|
2141
|
+
if (__p_.__state_->__has_value())
|
2142
|
+
throw future_error(make_error_code(future_errc::promise_already_satisfied));
|
2143
|
+
try
|
2144
|
+
{
|
2145
|
+
#endif // _LIBCPP_NO_EXCEPTIONS
|
2146
|
+
__f_(_VSTD::forward<_ArgTypes>(__args)...);
|
2147
|
+
__p_.set_value_at_thread_exit();
|
2148
|
+
#ifndef _LIBCPP_NO_EXCEPTIONS
|
2149
|
+
}
|
2150
|
+
catch (...)
|
2151
|
+
{
|
2152
|
+
__p_.set_exception_at_thread_exit(current_exception());
|
2153
|
+
}
|
2154
|
+
#endif // _LIBCPP_NO_EXCEPTIONS
|
2155
|
+
}
|
2156
|
+
|
2157
|
+
template<class ..._ArgTypes>
|
2158
|
+
void
|
2159
|
+
packaged_task<void(_ArgTypes...)>::reset()
|
2160
|
+
{
|
2161
|
+
#ifndef _LIBCPP_NO_EXCEPTIONS
|
2162
|
+
if (!valid())
|
2163
|
+
throw future_error(make_error_code(future_errc::no_state));
|
2164
|
+
#endif // _LIBCPP_NO_EXCEPTIONS
|
2165
|
+
__p_ = promise<result_type>();
|
2166
|
+
}
|
2167
|
+
|
2168
|
+
template <class _Callable>
|
2169
|
+
inline _LIBCPP_INLINE_VISIBILITY
|
2170
|
+
void
|
2171
|
+
swap(packaged_task<_Callable>& __x, packaged_task<_Callable>& __y) _NOEXCEPT
|
2172
|
+
{
|
2173
|
+
__x.swap(__y);
|
2174
|
+
}
|
2175
|
+
|
2176
|
+
template <class _Callable, class _Alloc>
|
2177
|
+
struct _LIBCPP_TYPE_VIS uses_allocator<packaged_task<_Callable>, _Alloc>
|
2178
|
+
: public true_type {};
|
2179
|
+
|
2180
|
+
template <class _Rp, class _Fp>
|
2181
|
+
future<_Rp>
|
2182
|
+
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
2183
|
+
__make_deferred_assoc_state(_Fp&& __f)
|
2184
|
+
#else
|
2185
|
+
__make_deferred_assoc_state(_Fp __f)
|
2186
|
+
#endif
|
2187
|
+
{
|
2188
|
+
unique_ptr<__deferred_assoc_state<_Rp, _Fp>, __release_shared_count>
|
2189
|
+
__h(new __deferred_assoc_state<_Rp, _Fp>(_VSTD::forward<_Fp>(__f)));
|
2190
|
+
return future<_Rp>(__h.get());
|
2191
|
+
}
|
2192
|
+
|
2193
|
+
template <class _Rp, class _Fp>
|
2194
|
+
future<_Rp>
|
2195
|
+
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
2196
|
+
__make_async_assoc_state(_Fp&& __f)
|
2197
|
+
#else
|
2198
|
+
__make_async_assoc_state(_Fp __f)
|
2199
|
+
#endif
|
2200
|
+
{
|
2201
|
+
unique_ptr<__async_assoc_state<_Rp, _Fp>, __release_shared_count>
|
2202
|
+
__h(new __async_assoc_state<_Rp, _Fp>(_VSTD::forward<_Fp>(__f)));
|
2203
|
+
_VSTD::thread(&__async_assoc_state<_Rp, _Fp>::__execute, __h.get()).detach();
|
2204
|
+
return future<_Rp>(__h.get());
|
2205
|
+
}
|
2206
|
+
|
2207
|
+
template <class _Fp, class... _Args>
|
2208
|
+
class __async_func
|
2209
|
+
{
|
2210
|
+
tuple<_Fp, _Args...> __f_;
|
2211
|
+
|
2212
|
+
public:
|
2213
|
+
typedef typename __invoke_of<_Fp, _Args...>::type _Rp;
|
2214
|
+
|
2215
|
+
_LIBCPP_INLINE_VISIBILITY
|
2216
|
+
explicit __async_func(_Fp&& __f, _Args&&... __args)
|
2217
|
+
: __f_(_VSTD::move(__f), _VSTD::move(__args)...) {}
|
2218
|
+
|
2219
|
+
_LIBCPP_INLINE_VISIBILITY
|
2220
|
+
__async_func(__async_func&& __f) : __f_(_VSTD::move(__f.__f_)) {}
|
2221
|
+
|
2222
|
+
_Rp operator()()
|
2223
|
+
{
|
2224
|
+
typedef typename __make_tuple_indices<1+sizeof...(_Args), 1>::type _Index;
|
2225
|
+
return __execute(_Index());
|
2226
|
+
}
|
2227
|
+
private:
|
2228
|
+
template <size_t ..._Indices>
|
2229
|
+
_Rp
|
2230
|
+
__execute(__tuple_indices<_Indices...>)
|
2231
|
+
{
|
2232
|
+
return __invoke(_VSTD::move(_VSTD::get<0>(__f_)), _VSTD::move(_VSTD::get<_Indices>(__f_))...);
|
2233
|
+
}
|
2234
|
+
};
|
2235
|
+
|
2236
|
+
template <class _Fp, class... _Args>
|
2237
|
+
future<typename __invoke_of<typename decay<_Fp>::type, typename decay<_Args>::type...>::type>
|
2238
|
+
async(launch __policy, _Fp&& __f, _Args&&... __args)
|
2239
|
+
{
|
2240
|
+
typedef __async_func<typename decay<_Fp>::type, typename decay<_Args>::type...> _BF;
|
2241
|
+
typedef typename _BF::_Rp _Rp;
|
2242
|
+
future<_Rp> __r;
|
2243
|
+
if (int(__policy) & int(launch::async))
|
2244
|
+
__r = _VSTD::__make_async_assoc_state<_Rp>(_BF(__decay_copy(_VSTD::forward<_Fp>(__f)),
|
2245
|
+
__decay_copy(_VSTD::forward<_Args>(__args))...));
|
2246
|
+
else if (int(__policy) & int(launch::deferred))
|
2247
|
+
__r = _VSTD::__make_deferred_assoc_state<_Rp>(_BF(__decay_copy(_VSTD::forward<_Fp>(__f)),
|
2248
|
+
__decay_copy(_VSTD::forward<_Args>(__args))...));
|
2249
|
+
return __r;
|
2250
|
+
}
|
2251
|
+
|
2252
|
+
template <class _Fp, class... _Args>
|
2253
|
+
inline _LIBCPP_INLINE_VISIBILITY
|
2254
|
+
future<typename __invoke_of<typename decay<_Fp>::type, typename decay<_Args>::type...>::type>
|
2255
|
+
async(_Fp&& __f, _Args&&... __args)
|
2256
|
+
{
|
2257
|
+
return _VSTD::async(launch::any, _VSTD::forward<_Fp>(__f),
|
2258
|
+
_VSTD::forward<_Args>(__args)...);
|
2259
|
+
}
|
2260
|
+
|
2261
|
+
#endif // _LIBCPP_HAS_NO_VARIADICS
|
2262
|
+
|
2263
|
+
// shared_future
|
2264
|
+
|
2265
|
+
template <class _Rp>
|
2266
|
+
class _LIBCPP_TYPE_VIS shared_future
|
2267
|
+
{
|
2268
|
+
__assoc_state<_Rp>* __state_;
|
2269
|
+
|
2270
|
+
public:
|
2271
|
+
_LIBCPP_INLINE_VISIBILITY
|
2272
|
+
shared_future() _NOEXCEPT : __state_(nullptr) {}
|
2273
|
+
_LIBCPP_INLINE_VISIBILITY
|
2274
|
+
shared_future(const shared_future& __rhs) : __state_(__rhs.__state_)
|
2275
|
+
{if (__state_) __state_->__add_shared();}
|
2276
|
+
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
2277
|
+
_LIBCPP_INLINE_VISIBILITY
|
2278
|
+
shared_future(future<_Rp>&& __f) _NOEXCEPT : __state_(__f.__state_)
|
2279
|
+
{__f.__state_ = nullptr;}
|
2280
|
+
_LIBCPP_INLINE_VISIBILITY
|
2281
|
+
shared_future(shared_future&& __rhs) _NOEXCEPT : __state_(__rhs.__state_)
|
2282
|
+
{__rhs.__state_ = nullptr;}
|
2283
|
+
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
2284
|
+
~shared_future();
|
2285
|
+
shared_future& operator=(const shared_future& __rhs);
|
2286
|
+
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
2287
|
+
_LIBCPP_INLINE_VISIBILITY
|
2288
|
+
shared_future& operator=(shared_future&& __rhs) _NOEXCEPT
|
2289
|
+
{
|
2290
|
+
shared_future(std::move(__rhs)).swap(*this);
|
2291
|
+
return *this;
|
2292
|
+
}
|
2293
|
+
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
2294
|
+
|
2295
|
+
// retrieving the value
|
2296
|
+
_LIBCPP_INLINE_VISIBILITY
|
2297
|
+
const _Rp& get() const {return __state_->copy();}
|
2298
|
+
|
2299
|
+
_LIBCPP_INLINE_VISIBILITY
|
2300
|
+
void swap(shared_future& __rhs) _NOEXCEPT {_VSTD::swap(__state_, __rhs.__state_);}
|
2301
|
+
|
2302
|
+
// functions to check state
|
2303
|
+
_LIBCPP_INLINE_VISIBILITY
|
2304
|
+
bool valid() const _NOEXCEPT {return __state_ != nullptr;}
|
2305
|
+
|
2306
|
+
_LIBCPP_INLINE_VISIBILITY
|
2307
|
+
void wait() const {__state_->wait();}
|
2308
|
+
template <class _Rep, class _Period>
|
2309
|
+
_LIBCPP_INLINE_VISIBILITY
|
2310
|
+
future_status
|
2311
|
+
wait_for(const chrono::duration<_Rep, _Period>& __rel_time) const
|
2312
|
+
{return __state_->wait_for(__rel_time);}
|
2313
|
+
template <class _Clock, class _Duration>
|
2314
|
+
_LIBCPP_INLINE_VISIBILITY
|
2315
|
+
future_status
|
2316
|
+
wait_until(const chrono::time_point<_Clock, _Duration>& __abs_time) const
|
2317
|
+
{return __state_->wait_until(__abs_time);}
|
2318
|
+
};
|
2319
|
+
|
2320
|
+
template <class _Rp>
|
2321
|
+
shared_future<_Rp>::~shared_future()
|
2322
|
+
{
|
2323
|
+
if (__state_)
|
2324
|
+
__state_->__release_shared();
|
2325
|
+
}
|
2326
|
+
|
2327
|
+
template <class _Rp>
|
2328
|
+
shared_future<_Rp>&
|
2329
|
+
shared_future<_Rp>::operator=(const shared_future& __rhs)
|
2330
|
+
{
|
2331
|
+
if (__rhs.__state_)
|
2332
|
+
__rhs.__state_->__add_shared();
|
2333
|
+
if (__state_)
|
2334
|
+
__state_->__release_shared();
|
2335
|
+
__state_ = __rhs.__state_;
|
2336
|
+
return *this;
|
2337
|
+
}
|
2338
|
+
|
2339
|
+
template <class _Rp>
|
2340
|
+
class _LIBCPP_TYPE_VIS shared_future<_Rp&>
|
2341
|
+
{
|
2342
|
+
__assoc_state<_Rp&>* __state_;
|
2343
|
+
|
2344
|
+
public:
|
2345
|
+
_LIBCPP_INLINE_VISIBILITY
|
2346
|
+
shared_future() _NOEXCEPT : __state_(nullptr) {}
|
2347
|
+
_LIBCPP_INLINE_VISIBILITY
|
2348
|
+
shared_future(const shared_future& __rhs) : __state_(__rhs.__state_)
|
2349
|
+
{if (__state_) __state_->__add_shared();}
|
2350
|
+
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
2351
|
+
_LIBCPP_INLINE_VISIBILITY
|
2352
|
+
shared_future(future<_Rp&>&& __f) _NOEXCEPT : __state_(__f.__state_)
|
2353
|
+
{__f.__state_ = nullptr;}
|
2354
|
+
_LIBCPP_INLINE_VISIBILITY
|
2355
|
+
shared_future(shared_future&& __rhs) _NOEXCEPT : __state_(__rhs.__state_)
|
2356
|
+
{__rhs.__state_ = nullptr;}
|
2357
|
+
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
2358
|
+
~shared_future();
|
2359
|
+
shared_future& operator=(const shared_future& __rhs);
|
2360
|
+
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
2361
|
+
_LIBCPP_INLINE_VISIBILITY
|
2362
|
+
shared_future& operator=(shared_future&& __rhs) _NOEXCEPT
|
2363
|
+
{
|
2364
|
+
shared_future(std::move(__rhs)).swap(*this);
|
2365
|
+
return *this;
|
2366
|
+
}
|
2367
|
+
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
2368
|
+
|
2369
|
+
// retrieving the value
|
2370
|
+
_LIBCPP_INLINE_VISIBILITY
|
2371
|
+
_Rp& get() const {return __state_->copy();}
|
2372
|
+
|
2373
|
+
_LIBCPP_INLINE_VISIBILITY
|
2374
|
+
void swap(shared_future& __rhs) _NOEXCEPT {_VSTD::swap(__state_, __rhs.__state_);}
|
2375
|
+
|
2376
|
+
// functions to check state
|
2377
|
+
_LIBCPP_INLINE_VISIBILITY
|
2378
|
+
bool valid() const _NOEXCEPT {return __state_ != nullptr;}
|
2379
|
+
|
2380
|
+
_LIBCPP_INLINE_VISIBILITY
|
2381
|
+
void wait() const {__state_->wait();}
|
2382
|
+
template <class _Rep, class _Period>
|
2383
|
+
_LIBCPP_INLINE_VISIBILITY
|
2384
|
+
future_status
|
2385
|
+
wait_for(const chrono::duration<_Rep, _Period>& __rel_time) const
|
2386
|
+
{return __state_->wait_for(__rel_time);}
|
2387
|
+
template <class _Clock, class _Duration>
|
2388
|
+
_LIBCPP_INLINE_VISIBILITY
|
2389
|
+
future_status
|
2390
|
+
wait_until(const chrono::time_point<_Clock, _Duration>& __abs_time) const
|
2391
|
+
{return __state_->wait_until(__abs_time);}
|
2392
|
+
};
|
2393
|
+
|
2394
|
+
template <class _Rp>
|
2395
|
+
shared_future<_Rp&>::~shared_future()
|
2396
|
+
{
|
2397
|
+
if (__state_)
|
2398
|
+
__state_->__release_shared();
|
2399
|
+
}
|
2400
|
+
|
2401
|
+
template <class _Rp>
|
2402
|
+
shared_future<_Rp&>&
|
2403
|
+
shared_future<_Rp&>::operator=(const shared_future& __rhs)
|
2404
|
+
{
|
2405
|
+
if (__rhs.__state_)
|
2406
|
+
__rhs.__state_->__add_shared();
|
2407
|
+
if (__state_)
|
2408
|
+
__state_->__release_shared();
|
2409
|
+
__state_ = __rhs.__state_;
|
2410
|
+
return *this;
|
2411
|
+
}
|
2412
|
+
|
2413
|
+
template <>
|
2414
|
+
class _LIBCPP_TYPE_VIS shared_future<void>
|
2415
|
+
{
|
2416
|
+
__assoc_sub_state* __state_;
|
2417
|
+
|
2418
|
+
public:
|
2419
|
+
_LIBCPP_INLINE_VISIBILITY
|
2420
|
+
shared_future() _NOEXCEPT : __state_(nullptr) {}
|
2421
|
+
_LIBCPP_INLINE_VISIBILITY
|
2422
|
+
shared_future(const shared_future& __rhs) : __state_(__rhs.__state_)
|
2423
|
+
{if (__state_) __state_->__add_shared();}
|
2424
|
+
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
2425
|
+
_LIBCPP_INLINE_VISIBILITY
|
2426
|
+
shared_future(future<void>&& __f) _NOEXCEPT : __state_(__f.__state_)
|
2427
|
+
{__f.__state_ = nullptr;}
|
2428
|
+
_LIBCPP_INLINE_VISIBILITY
|
2429
|
+
shared_future(shared_future&& __rhs) _NOEXCEPT : __state_(__rhs.__state_)
|
2430
|
+
{__rhs.__state_ = nullptr;}
|
2431
|
+
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
2432
|
+
~shared_future();
|
2433
|
+
shared_future& operator=(const shared_future& __rhs);
|
2434
|
+
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
2435
|
+
_LIBCPP_INLINE_VISIBILITY
|
2436
|
+
shared_future& operator=(shared_future&& __rhs) _NOEXCEPT
|
2437
|
+
{
|
2438
|
+
shared_future(std::move(__rhs)).swap(*this);
|
2439
|
+
return *this;
|
2440
|
+
}
|
2441
|
+
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
2442
|
+
|
2443
|
+
// retrieving the value
|
2444
|
+
_LIBCPP_INLINE_VISIBILITY
|
2445
|
+
void get() const {__state_->copy();}
|
2446
|
+
|
2447
|
+
_LIBCPP_INLINE_VISIBILITY
|
2448
|
+
void swap(shared_future& __rhs) _NOEXCEPT {_VSTD::swap(__state_, __rhs.__state_);}
|
2449
|
+
|
2450
|
+
// functions to check state
|
2451
|
+
_LIBCPP_INLINE_VISIBILITY
|
2452
|
+
bool valid() const _NOEXCEPT {return __state_ != nullptr;}
|
2453
|
+
|
2454
|
+
_LIBCPP_INLINE_VISIBILITY
|
2455
|
+
void wait() const {__state_->wait();}
|
2456
|
+
template <class _Rep, class _Period>
|
2457
|
+
_LIBCPP_INLINE_VISIBILITY
|
2458
|
+
future_status
|
2459
|
+
wait_for(const chrono::duration<_Rep, _Period>& __rel_time) const
|
2460
|
+
{return __state_->wait_for(__rel_time);}
|
2461
|
+
template <class _Clock, class _Duration>
|
2462
|
+
_LIBCPP_INLINE_VISIBILITY
|
2463
|
+
future_status
|
2464
|
+
wait_until(const chrono::time_point<_Clock, _Duration>& __abs_time) const
|
2465
|
+
{return __state_->wait_until(__abs_time);}
|
2466
|
+
};
|
2467
|
+
|
2468
|
+
template <class _Rp>
|
2469
|
+
inline _LIBCPP_INLINE_VISIBILITY
|
2470
|
+
void
|
2471
|
+
swap(shared_future<_Rp>& __x, shared_future<_Rp>& __y) _NOEXCEPT
|
2472
|
+
{
|
2473
|
+
__x.swap(__y);
|
2474
|
+
}
|
2475
|
+
|
2476
|
+
template <class _Rp>
|
2477
|
+
inline _LIBCPP_INLINE_VISIBILITY
|
2478
|
+
shared_future<_Rp>
|
2479
|
+
future<_Rp>::share()
|
2480
|
+
{
|
2481
|
+
return shared_future<_Rp>(_VSTD::move(*this));
|
2482
|
+
}
|
2483
|
+
|
2484
|
+
template <class _Rp>
|
2485
|
+
inline _LIBCPP_INLINE_VISIBILITY
|
2486
|
+
shared_future<_Rp&>
|
2487
|
+
future<_Rp&>::share()
|
2488
|
+
{
|
2489
|
+
return shared_future<_Rp&>(_VSTD::move(*this));
|
2490
|
+
}
|
2491
|
+
|
2492
|
+
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
2493
|
+
|
2494
|
+
inline _LIBCPP_INLINE_VISIBILITY
|
2495
|
+
shared_future<void>
|
2496
|
+
future<void>::share()
|
2497
|
+
{
|
2498
|
+
return shared_future<void>(_VSTD::move(*this));
|
2499
|
+
}
|
2500
|
+
|
2501
|
+
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
2502
|
+
|
2503
|
+
_LIBCPP_END_NAMESPACE_STD
|
2504
|
+
|
2505
|
+
#endif // _LIBCPP_FUTURE
|