diff options
| author | Benoit Germain <benoit.germain@ubisoft.com> | 2024-07-04 09:12:32 +0200 |
|---|---|---|
| committer | Benoit Germain <benoit.germain@ubisoft.com> | 2024-07-04 09:12:32 +0200 |
| commit | f37a7c2334fdfb8f30d0b76ecf25aff484adec28 (patch) | |
| tree | 2385dc68660e8cc15dd9cc7172e2d0f53740dd01 /tests | |
| parent | acb1fa879beb68c10287b8438f18b80b2700042f (diff) | |
| download | lanes-f37a7c2334fdfb8f30d0b76ecf25aff484adec28.tar.gz lanes-f37a7c2334fdfb8f30d0b76ecf25aff484adec28.tar.bz2 lanes-f37a7c2334fdfb8f30d0b76ecf25aff484adec28.zip | |
Fix finalizers in coroutine lanes
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/cancel.lua | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/tests/cancel.lua b/tests/cancel.lua index 9ee986c..8dfccd2 100644 --- a/tests/cancel.lua +++ b/tests/cancel.lua | |||
| @@ -26,6 +26,9 @@ local linda = lanes.linda() | |||
| 26 | -- a numeric value to read | 26 | -- a numeric value to read |
| 27 | linda:set( "val", 33.0) | 27 | linda:set( "val", 33.0) |
| 28 | 28 | ||
| 29 | -- so that we can easily swap between lanes.gen and lanes.coro, to try stuff | ||
| 30 | local generator = lanes.coro | ||
| 31 | |||
| 29 | -- ################################################################################################## | 32 | -- ################################################################################################## |
| 30 | 33 | ||
| 31 | if not next(which_tests) or which_tests.genlock then | 34 | if not next(which_tests) or which_tests.genlock then |
| @@ -149,7 +152,7 @@ end | |||
| 149 | if not next(which_tests) or which_tests.linda then | 152 | if not next(which_tests) or which_tests.linda then |
| 150 | remaining_tests.linda = nil | 153 | remaining_tests.linda = nil |
| 151 | print "\n\n####################################################################\nbegin linda cancel test\n" | 154 | print "\n\n####################################################################\nbegin linda cancel test\n" |
| 152 | h = lanes.gen( "*", laneBody)( "receive", nil) -- start an infinite wait on the linda | 155 | h = generator( "*", laneBody)( "receive", nil) -- start an infinite wait on the linda |
| 153 | 156 | ||
| 154 | print "wait 1s" | 157 | print "wait 1s" |
| 155 | SLEEP(1) | 158 | SLEEP(1) |
| @@ -170,7 +173,7 @@ end | |||
| 170 | if not next(which_tests) or which_tests.soft then | 173 | if not next(which_tests) or which_tests.soft then |
| 171 | remaining_tests.soft = nil | 174 | remaining_tests.soft = nil |
| 172 | print "\n\n####################################################################\nbegin soft cancel test\n" | 175 | print "\n\n####################################################################\nbegin soft cancel test\n" |
| 173 | h = lanes.gen( "*", protectedBody)( "receive") -- start an infinite wait on the linda | 176 | h = generator( "*", protectedBody)( "receive") -- start an infinite wait on the linda |
| 174 | 177 | ||
| 175 | print "wait 1s" | 178 | print "wait 1s" |
| 176 | SLEEP(1) | 179 | SLEEP(1) |
| @@ -194,7 +197,7 @@ end | |||
| 194 | if not next(which_tests) or which_tests.hook then | 197 | if not next(which_tests) or which_tests.hook then |
| 195 | remaining_tests.hook = nil | 198 | remaining_tests.hook = nil |
| 196 | print "\n\n####################################################################\nbegin hook cancel test\n" | 199 | print "\n\n####################################################################\nbegin hook cancel test\n" |
| 197 | h = lanes.gen( "*", protectedBody)( "get", 300000) | 200 | h = generator( "*", protectedBody)( "get", 300000) |
| 198 | print "wait 2s" | 201 | print "wait 2s" |
| 199 | SLEEP(2) | 202 | SLEEP(2) |
| 200 | 203 | ||
| @@ -230,7 +233,7 @@ end | |||
| 230 | if not next(which_tests) or which_tests.hard_unprotected then | 233 | if not next(which_tests) or which_tests.hard_unprotected then |
| 231 | remaining_tests.hard_unprotected = nil | 234 | remaining_tests.hard_unprotected = nil |
| 232 | print "\n\n####################################################################\nbegin hard cancel test with unprotected lane body\n" | 235 | print "\n\n####################################################################\nbegin hard cancel test with unprotected lane body\n" |
| 233 | h = lanes.gen( "*", laneBody)( "receive", nil) | 236 | h = generator( "*", laneBody)( "receive", nil) |
| 234 | 237 | ||
| 235 | -- wait 2s before cancelling the lane | 238 | -- wait 2s before cancelling the lane |
| 236 | print "wait 2s" | 239 | print "wait 2s" |
