Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in / Register
Toggle navigation
P
ParaEncode
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Linshizhi
ParaEncode
Commits
5b143f4f
Commit
5b143f4f
authored
May 04, 2022
by
NzSN
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update
parent
88aa6f05
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
9 additions
and
5 deletions
+9
-5
muxWW.js
resources/workers/muxWW.js
+8
-4
WW.spec.js
tests/WW.spec.js
+1
-1
No files found.
resources/workers/muxWW.js
View file @
5b143f4f
...
@@ -7,6 +7,8 @@ let bridge = null;
...
@@ -7,6 +7,8 @@ let bridge = null;
let
muxer
=
null
;
let
muxer
=
null
;
let
numOfEncs
=
1
;
let
numOfEncs
=
1
;
let
channels
=
[];
// Constants
// Constants
const
SLEEP_INTERVAL
=
100
;
const
SLEEP_INTERVAL
=
100
;
const
SPIN_TIMEOUT
=
500
;
const
SPIN_TIMEOUT
=
500
;
...
@@ -89,6 +91,7 @@ async function bridging(msg) {
...
@@ -89,6 +91,7 @@ async function bridging(msg) {
}
}
bridge
=
new
Channel
(
info
.
size
,
SharedArrayBuffer
,
info
.
shm
);
bridge
=
new
Channel
(
info
.
size
,
SharedArrayBuffer
,
info
.
shm
);
channels
.
push
(
bridge
);
isBridged
=
true
;
isBridged
=
true
;
}
}
...
@@ -111,14 +114,15 @@ async function steps() {
...
@@ -111,14 +114,15 @@ async function steps() {
src
.
setPriv
(
MSG
.
PRIV_FLAGS
.
EXECUTING
);
src
.
setPriv
(
MSG
.
PRIV_FLAGS
.
EXECUTING
);
while
(
timeout
>
0
)
{
while
(
timeout
>
0
)
{
if
(
await
step
()
===
false
&&
retryCount
>=
0
)
{
if
(
await
step
()
===
false
)
{
timeout
-=
SLEEP_INTERVAL
;
await
sleep
(
SLEEP_INTERVAL
);
await
sleep
(
SLEEP_INTERVAL
);
timeout
-=
SLEEP_INTERVAL
;
}
else
{
timeout
=
SPIN_TIMEOUT
;
}
}
}
}
src
.
unsetPriv
(
MSG
.
PRIV_FLAGS
.
EXECUTING
);
src
.
unsetPriv
(
MSG
.
PRIV_FLAGS
.
EXECUTING
);
postMessage
(
makeMsg
(
MESSAGE_TYPE
.
DATA_REQUIRE
,
{}))
postMessage
(
makeMsg
(
MESSAGE_TYPE
.
DATA_REQUIRE
,
{}))
;
}
}
tests/WW.spec.js
View file @
5b143f4f
...
@@ -182,7 +182,7 @@ describe("EncWW Specifications", () => {
...
@@ -182,7 +182,7 @@ describe("EncWW Specifications", () => {
await
sleep
(
1000
);
await
sleep
(
1000
);
});
});
f
it
(
"Mux WW Spec"
,
async
()
=>
{
it
(
"Mux WW Spec"
,
async
()
=>
{
let
mux
=
new
WW
(
"MUX"
,
"../resources/workers/muxWW.js"
);
let
mux
=
new
WW
(
"MUX"
,
"../resources/workers/muxWW.js"
);
let
mem
=
new
SharedArrayBuffer
(
1024
);
let
mem
=
new
SharedArrayBuffer
(
1024
);
...
...
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