Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
Shayne Fletcher
Glasgow Haskell Compiler
Commits
6a695ced
Commit
6a695ced
authored
May 24, 2005
by
simonmar
Browse files
[project @ 2005-05-24 15:43:32 by simonmar]
implement lockClosure properly
parent
e022e6a0
Changes
1
Hide whitespace changes
Inline
Side-by-side
ghc/includes/SMP.h
View file @
6a695ced
...
...
@@ -33,7 +33,7 @@ xchg(StgPtr p, StgWord w)
StgWord
result
;
result
=
w
;
__asm__
__volatile__
(
"xchg
l
%1,%0"
"xchg %1,%0"
:
"+r"
(
result
),
"+m"
(
*
p
)
:
/* no input-only operands */
);
...
...
@@ -43,15 +43,26 @@ xchg(StgPtr p, StgWord w)
INLINE_HEADER
StgInfoTable
*
lockClosure
(
StgClosure
*
p
)
{
#if i386_HOST_ARCH || x86_64_HOST_ARCH
StgWord
info
;
#if 0
do
{
info
=
xchg
((
P_
)
&
p
->
header
.
info
,
(
W_
)
&
stg_WHITEHOLE_info
);
if
(
info
!=
(
W_
)
&
stg_WHITEHOLE_info
)
return
(
StgInfoTable
*
)
info
;
yieldThread
();
}
while
(
1
);
#else
info
=
p
->
header
.
info
;
ACQUIRE_SM_LOCK
#endif
}
INLINE_HEADER
void
unlockClosure
(
StgClosure
*
p
,
StgInfoTable
*
info
)
{
#if i386_HOST_ARCH || x86_64_HOST_ARCH
// This is safe enough, because lockClosure() does the memory barrier:
p
->
header
.
info
=
info
;
#else
RELEASE_SM_LOCK
;
#endif
}
...
...
Write
Preview
Supports
Markdown
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