Skip to content

Contract with threaded method - #2830

Open
Delja wants to merge 4 commits into
nitlang:masterfrom
Delja:contract_multy_thread
Open

Contract with threaded method#2830
Delja wants to merge 4 commits into
nitlang:masterfrom
Delja:contract_multy_thread

Conversation

@Delja

@DeljaDelja commented Aug 2, 2020

Copy link
Copy Markdown
Contributor

This pr makes it possible to prevent that contracts in different threads to interfere with the same flag to know if a contract evaluation should be performed.

Instead of using a flag contained in the Sys instance, we are now using a new AST node which:

  • During compilation it will be transformed into an if with for condition the evaluation of a variable whose value is specific to each threat ( in_assertion). Note we used the keyword __thread.

  • During the interpretation the node will be evaluated in the same way as an if (without an else block) with for condition the value of the attribute in_assertion defined in the interpreter.

Note: When you evaluate a contract, the evaluation is performed in the same thread as the caller. (only the method will be executed in a new thread)

@Delja
Deljaforce-pushed the contract_multy_thread branch 4 times, most recently from 8ee9b86 to a0ba0ccCompareAugust 4, 2020 15:29
@Delja
Deljaforce-pushed the contract_multy_thread branch 2 times, most recently from a8b205d to 823f0edCompareAugust 16, 2020 17:00
@Delja
Delja requested a review from privatAugust 16, 2020 21:00
This flag is used to know if we are currently checking some assertions.
Signed-off-by: Delja <deljarry.florian@gmail.com>
Signed-off-by: Delja <deljarry.florian@gmail.com>
Signed-off-by: Delja <deljarry.florian@gmail.com>
Signed-off-by: Delja <deljarry.florian@gmail.com>
@Delja
Deljaforce-pushed the contract_multy_thread branch from 823f0ed to 4375990CompareAugust 20, 2020 20:45
@privatprivat closed this Aug 16, 2024
@privatprivat reopened this Aug 16, 2024
@github-actions

Copy link
Copy Markdown

Test Results

67 files 338 suites 17m 34s ⏱️
14 192 tests 13 648 ✅ 544 💤 0 ❌
14 588 runs 14 028 ✅ 560 💤 0 ❌

Results for commit 4375990.

Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants

@Delja@privat