Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-winehq
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
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wine
wine-winehq
Commits
a11c8758
Commit
a11c8758
authored
Dec 30, 2014
by
Yifu Wang
Committed by
Alexandre Julliard
Feb 13, 2015
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
msvcr120: Fixed bugs in Concurrency::critical_section.
parent
f21a968d
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
18 additions
and
11 deletions
+18
-11
lock.c
dlls/msvcrt/lock.c
+18
-11
No files found.
dlls/msvcrt/lock.c
View file @
a11c8758
...
...
@@ -384,10 +384,11 @@ void __thiscall critical_section_lock(critical_section *this)
NtWaitForKeyedEvent
(
keyed_event
,
&
q
,
0
,
NULL
);
}
this
->
unk_active
.
next
=
NULL
;
if
(
InterlockedCompareExchangePointer
(
&
this
->
tail
,
&
this
->
unk_active
,
&
q
)
!=
&
q
)
spin_wait_for_next_cs
(
&
q
);
cs_set_head
(
this
,
&
q
);
if
(
InterlockedCompareExchangePointer
(
&
this
->
tail
,
&
this
->
unk_active
,
&
q
)
!=
&
q
)
{
spin_wait_for_next_cs
(
&
q
);
this
->
unk_active
.
next
=
q
.
next
;
}
}
/* ?try_lock@critical_section@Concurrency@@QAE_NXZ */
...
...
@@ -406,11 +407,11 @@ MSVCRT_bool __thiscall critical_section_try_lock(critical_section *this)
memset
(
&
q
,
0
,
sizeof
(
q
));
if
(
!
InterlockedCompareExchangePointer
(
&
this
->
tail
,
&
q
,
NULL
))
{
this
->
unk_active
.
next
=
NULL
;
if
(
InterlockedCompareExchangePointer
(
&
this
->
tail
,
&
this
->
unk_active
,
&
q
)
!=
&
q
)
spin_wait_for_next_cs
(
&
q
);
cs_set_head
(
this
,
&
q
);
if
(
InterlockedCompareExchangePointer
(
&
this
->
tail
,
&
this
->
unk_active
,
&
q
)
!=
&
q
)
{
spin_wait_for_next_cs
(
&
q
);
this
->
unk_active
.
next
=
q
.
next
;
}
return
TRUE
;
}
return
FALSE
;
...
...
@@ -437,8 +438,10 @@ void __thiscall critical_section_unlock(critical_section *this)
break
;
next
=
this
->
unk_active
.
next
;
if
(
InterlockedCompareExchangePointer
(
&
this
->
tail
,
NULL
,
next
)
==
next
)
if
(
InterlockedCompareExchangePointer
(
&
this
->
tail
,
NULL
,
next
)
==
next
)
{
HeapFree
(
GetProcessHeap
(),
0
,
next
);
return
;
}
spin_wait_for_next_cs
(
next
);
this
->
unk_active
.
next
=
next
->
next
;
...
...
@@ -491,14 +494,18 @@ MSVCRT_bool __thiscall critical_section_try_lock_for(
if
(
status
==
STATUS_TIMEOUT
)
{
if
(
!
InterlockedExchange
(
&
q
->
free
,
TRUE
))
return
FALSE
;
/* A thread has signaled the event and is block waiting. */
/* We need to catch the event to wake the thread. */
NtWaitForKeyedEvent
(
keyed_event
,
q
,
0
,
NULL
);
}
}
this
->
unk_active
.
next
=
NULL
;
if
(
InterlockedCompareExchangePointer
(
&
this
->
tail
,
&
this
->
unk_active
,
q
)
!=
q
)
cs_set_head
(
this
,
q
)
;
if
(
InterlockedCompareExchangePointer
(
&
this
->
tail
,
&
this
->
unk_active
,
q
)
!=
q
)
{
spin_wait_for_next_cs
(
q
);
this
->
unk_active
.
next
=
q
->
next
;
}
cs_set_head
(
this
,
q
);
HeapFree
(
GetProcessHeap
(),
0
,
q
);
return
TRUE
;
}
...
...
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