Skip to content

Commit

Permalink
Add parallel parameter description (#678)
Browse files Browse the repository at this point in the history
  • Loading branch information
JimmyShi22 committed Nov 11, 2019
1 parent 8553b0f commit 66305ed
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions docs/manual/transaction_parallel.md
Original file line number Diff line number Diff line change
Expand Up @@ -126,11 +126,11 @@ contract ParallelOk is ParallelContract // 将ParallelContract 作为基类
在编写接口前,先确定接口的互斥参数,接口的互斥即是对全局变量的互斥,互斥参数的确定规则为:
- 接口访问了全局mapping,mapping的key是互斥参数
- 接口访问了全局数组,数组的下标是互斥参数
- 接口访问了简单类型的全局变量,所有简单类型的全局变量共用一个互斥参数,用不同的变量名作为互斥对象
> 例如:合约里有多个简单类型的全局变量,不同接口访问了不同的全局变量。如要将不同接口并行,则需要在修改了全局变量的接口参数中定义一个互斥参数,用来调用时指明使用了哪个全局变量。在调用时,主动给互斥参数传递相应修改的全局变量的“变量名”,用以标明此笔交易的互斥对象。如:`setA(int x)`函数中修改了全局参数`globalA`,则需要将`setA`函数定义为`set(string aflag, int x)`, 在调用时,传入`setA("globalA", 10)`,用变量名`“globalA”`来指明此交易的互斥对象是`globalA`
**确定参数类型和顺序**
确定互斥参数后,根据规则确定参数类型和顺序,规则为:
Expand Down
4 changes: 2 additions & 2 deletions en/docs/manual/transaction_parallel.md
Original file line number Diff line number Diff line change
Expand Up @@ -126,11 +126,11 @@ A parallelable contract interface has to meet following conditions:
Before compiling interface, please confirm the exclusive parameter of interface. The exclusion of interface is the exclusion of global variables. The confirmation of exclusive parameter has following rules:
- the interface accessed global mapping, the key of mapping is the exclusive parameter
- the interface accessed global arrays, the subscript of a array is the exclusive parameter
- the interface accessed simple type of global variables, all the simple type global variables share one exclusive parameter and use different variable names as the exclusive objects.
> For example: If `setA(int x)`writes `globalA`, we need to declare it as `setA(string aflag, int x)` and call it like `setA("globalA", 10)` by using `globalA` to declare the exclusive object.
**Confirm parameter type and sequence**
After the exclusive parameter is confirmed, confirm parameter type and sequence according to following rules:
Expand Down

0 comments on commit 66305ed

Please sign in to comment.