Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
F
frama-c
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Container Registry
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
pub
frama-c
Commits
02cd4983
Commit
02cd4983
authored
2 years ago
by
Loïc Correnson
Browse files
Options
Downloads
Patches
Plain Diff
[ivette/states] hold synchronized value
parent
0c2299e1
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
ivette/src/frama-c/states.ts
+7
-4
7 additions, 4 deletions
ivette/src/frama-c/states.ts
with
7 additions
and
4 deletions
ivette/src/frama-c/states.ts
+
7
−
4
View file @
02cd4983
...
@@ -284,10 +284,11 @@ class SyncState<A> {
...
@@ -284,10 +284,11 @@ class SyncState<A> {
}
}
getValue
():
A
|
undefined
{
getValue
():
A
|
undefined
{
if
(
!
this
.
upToDate
&&
Server
.
isRunning
())
{
const
running
=
Server
.
isRunning
();
if
(
!
this
.
upToDate
&&
running
)
{
this
.
update
();
this
.
update
();
}
}
return
this
.
value
;
return
running
?
this
.
value
:
undefined
;
}
}
async
setValue
(
v
:
A
):
Promise
<
void
>
{
async
setValue
(
v
:
A
):
Promise
<
void
>
{
...
@@ -309,18 +310,20 @@ class SyncState<A> {
...
@@ -309,18 +310,20 @@ class SyncState<A> {
async
update
():
Promise
<
void
>
{
async
update
():
Promise
<
void
>
{
try
{
try
{
this
.
upToDate
=
true
;
this
.
upToDate
=
true
;
this
.
value
=
undefined
;
this
.
UPDATE
.
emit
();
if
(
Server
.
isRunning
())
{
if
(
Server
.
isRunning
())
{
const
v
=
await
Server
.
send
(
this
.
handler
.
getter
,
null
);
const
v
=
await
Server
.
send
(
this
.
handler
.
getter
,
null
);
this
.
value
=
v
;
this
.
value
=
v
;
this
.
UPDATE
.
emit
();
this
.
UPDATE
.
emit
();
}
else
if
(
this
.
value
!==
undefined
)
{
this
.
value
=
undefined
;
this
.
UPDATE
.
emit
();
}
}
}
catch
(
error
)
{
}
catch
(
error
)
{
D
.
error
(
D
.
error
(
`Fail to update SyncState '
${
this
.
handler
.
name
}
'.`
,
`Fail to update SyncState '
${
this
.
handler
.
name
}
'.`
,
`
${
error
}
`
,
`
${
error
}
`
,
);
);
this
.
value
=
undefined
;
this
.
UPDATE
.
emit
();
this
.
UPDATE
.
emit
();
}
}
}
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment