Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
E
eager-future2
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container registry
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Vladimir Sedach
eager-future2
Commits
a03efded
Commit
a03efded
authored
14 years ago
by
Vladimir Sedach
Browse files
Options
Downloads
Patches
Plain Diff
Fixed race condition w/multiple threads trying to compute same future.
parent
c4016f06
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
future.lisp
+1
-1
1 addition, 1 deletion
future.lisp
make-future.lisp
+1
-1
1 addition, 1 deletion
make-future.lisp
with
2 additions
and
2 deletions
future.lisp
+
1
−
1
View file @
a03efded
...
@@ -53,7 +53,7 @@ computation of the future)."
...
@@ -53,7 +53,7 @@ computation of the future)."
(
with-lock-held
((
lock
future
))
(
with-lock-held
((
lock
future
))
(
when
(
%ready-to-yield?
future
)
(
when
(
%ready-to-yield?
future
)
(
return-from
select
future
))
(
return-from
select
future
))
(
when
(
and
(
not
any-computing?
)
(
computing-thread
future
)
)
(
when
(
computing-thread
future
)
(
setf
any-computing?
t
))
(
setf
any-computing?
t
))
(
push
(
cons
select-lock
notifier
)
(
wait-list
future
))))
(
push
(
cons
select-lock
notifier
)
(
wait-list
future
))))
(
unless
any-computing?
(
unless
any-computing?
...
...
This diff is collapsed.
Click to expand it.
make-future.lisp
+
1
−
1
View file @
a03efded
...
@@ -22,7 +22,7 @@ If lazy, newly created futures are not computed until asked to yield their value
...
@@ -22,7 +22,7 @@ If lazy, newly created futures are not computed until asked to yield their value
(
flet
((
get-future
()
(
or
(
weak-pointer-value
future-ptr
)
(
throw
'task-done
nil
))))
(
flet
((
get-future
()
(
or
(
weak-pointer-value
future-ptr
)
(
throw
'task-done
nil
))))
(
let
((
*computing-future*
(
future-id
(
get-future
))))
(
let
((
*computing-future*
(
future-id
(
get-future
))))
(
with-lock-held
((
lock
(
get-future
)))
(
with-lock-held
((
lock
(
get-future
)))
(
if
(
%ready-to-yield?
(
get-future
))
(
if
(
or
(
%ready-to-yield?
(
get-future
))
(
computing-thread
(
get-future
)))
(
throw
'task-done
nil
)
(
throw
'task-done
nil
)
(
setf
(
computing-thread
(
get-future
))
(
current-thread
))))
(
setf
(
computing-thread
(
get-future
))
(
current-thread
))))
(
finalize
(
get-future
)
(
let
((
thread
(
current-thread
))
(
finalize
(
get-future
)
(
let
((
thread
(
current-thread
))
...
...
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