Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
R
renderjs
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Romain Courteaud
renderjs
Commits
5313f5e1
Commit
5313f5e1
authored
Jan 10, 2023
by
Romain Courteaud
🐸
1
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Reproduce Mutex bug
parent
ed4a061d
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
3 deletions
+11
-3
test/mutex_test.js
test/mutex_test.js
+11
-3
No files found.
test/mutex_test.js
View file @
5313f5e1
...
...
@@ -341,7 +341,7 @@
counter
=
0
,
defer
=
RSVP
.
defer
();
stop
();
expect
(
8
);
expect
(
10
);
function
assertCounter
(
value
)
{
equal
(
counter
,
value
);
counter
+=
1
;
...
...
@@ -364,10 +364,16 @@
return
'
callback1 result
'
;
});
}
function
callback3
()
{
// Ensure that callback3 is executed only when callback1 is finished
assertCounter
(
4
);
return
'
callback3 result
'
;
}
return
new
RSVP
.
Queue
()
.
push
(
function
()
{
var
promise1
=
mutex
.
lockAndRun
(
callback1
),
promise2
=
mutex
.
lockAndRun
(
callback2
);
promise2
=
mutex
.
lockAndRun
(
callback2
),
promise3
=
mutex
.
lockAndRun
(
callback3
);
return
RSVP
.
all
([
promise1
,
promise2
...
...
@@ -378,6 +384,7 @@
equal
(
error
.
message
,
'
cancel callback2
'
);
return
'
handler2 result
'
;
}),
promise3
,
defer
.
promise
.
then
(
function
()
{
assertCounter
(
1
);
...
...
@@ -388,7 +395,8 @@
.
push
(
function
(
result_list
)
{
equal
(
result_list
[
0
],
'
callback1 result
'
);
equal
(
result_list
[
1
],
'
handler2 result
'
);
assertCounter
(
4
);
equal
(
result_list
[
2
],
'
callback3 result
'
);
assertCounter
(
5
);
})
.
always
(
function
()
{
start
();
...
...
Romain Courteaud
🐸
@romain
mentioned in merge request
nexedi/erp5!1717 (merged)
·
Jan 10, 2023
mentioned in merge request
nexedi/erp5!1717 (merged)
mentioned in merge request nexedi/erp5!1717
Toggle commit list
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment