diff options
author | Alon Zakai <alonzakai@gmail.com> | 2016-06-26 13:39:31 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2016-06-26 13:39:31 -0700 |
commit | 29afb7a67fafb7b6325d5e8f60d37be0f65b0cb0 (patch) | |
tree | d07066424c58d0dbb672b80d8e5b3735620465cc /src/binaryen-c.h | |
parent | 45b358706c86415c5982f9e777fa9e19a33b27a3 (diff) | |
download | binaryen-29afb7a67fafb7b6325d5e8f60d37be0f65b0cb0.tar.gz binaryen-29afb7a67fafb7b6325d5e8f60d37be0f65b0cb0.tar.bz2 binaryen-29afb7a67fafb7b6325d5e8f60d37be0f65b0cb0.zip |
make creating functions and types parallelizable in c api (#603)
Diffstat (limited to 'src/binaryen-c.h')
-rw-r--r-- | src/binaryen-c.h | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/src/binaryen-c.h b/src/binaryen-c.h index 7403d0e81..1421325d9 100644 --- a/src/binaryen-c.h +++ b/src/binaryen-c.h @@ -23,6 +23,19 @@ // // The third part of the API lets you provide a general control-flow // graph (CFG) as input. +// +// --------------- +// +// Thread safety: You can create Expressions in parallel, as they do not +// refer to global state. BinaryenAddFunction and +// BinaryenAddFunctionType are also thread-safe, which means +// that you can create functions and their contents in multiple +// threads. This is important since functions are where the +// majority of the work is done. +// Other methods - creating imports, exports, etc. - are +// not currently thread-safe (as there is typically no need +// to parallelize them). +// //================ #ifndef binaryen_h @@ -80,6 +93,7 @@ void BinaryenModuleDispose(BinaryenModuleRef module); typedef void* BinaryenFunctionTypeRef; +// Add a new function type. This is thread-safe. // Note: name can be NULL, in which case we auto-generate a name BinaryenFunctionTypeRef BinaryenAddFunctionType(BinaryenModuleRef module, const char* name, BinaryenType result, BinaryenType* paramTypes, BinaryenIndex numParams); @@ -295,6 +309,7 @@ void BinaryenExpressionPrint(BinaryenExpressionRef expr); typedef void* BinaryenFunctionRef; +// Adds a function to the module. This is thread-safe. BinaryenFunctionRef BinaryenAddFunction(BinaryenModuleRef module, const char* name, BinaryenFunctionTypeRef type, BinaryenType* localTypes, BinaryenIndex numLocalTypes, BinaryenExpressionRef body); // Imports |