Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-fonts
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
Aleksandr Isakov
wine-fonts
Commits
2de16a57
Commit
2de16a57
authored
Jul 06, 2020
by
Zebediah Figura
Committed by
Vitaly Lipatov
Jul 30, 2022
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ntdll: Implement waiting on mutexes.
parent
829e6694
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
29 additions
and
2 deletions
+29
-2
esync.c
dlls/ntdll/unix/esync.c
+29
-2
No files found.
dlls/ntdll/unix/esync.c
View file @
2de16a57
...
...
@@ -504,7 +504,16 @@ static int do_poll( struct pollfd *fds, nfds_t nfds, ULONGLONG *end )
static
void
update_grabbed_object
(
struct
esync
*
obj
)
{
if
(
obj
->
type
==
ESYNC_SEMAPHORE
)
if
(
obj
->
type
==
ESYNC_MUTEX
)
{
struct
mutex
*
mutex
=
obj
->
shm
;
/* We don't have to worry about a race between this and read(); the
* fact that we grabbed it means the count is now zero, so nobody else
* can (and the only thread that can release it is us). */
mutex
->
tid
=
GetCurrentThreadId
();
mutex
->
count
++
;
}
else
if
(
obj
->
type
==
ESYNC_SEMAPHORE
)
{
struct
semaphore
*
semaphore
=
obj
->
shm
;
/* We don't have to worry about a race between this and read(); the
...
...
@@ -590,7 +599,25 @@ static NTSTATUS __esync_wait_objects( DWORD count, const HANDLE *handles, BOOLEA
{
for
(
i
=
0
;
i
<
count
;
i
++
)
{
fds
[
i
].
fd
=
objs
[
i
]
?
objs
[
i
]
->
fd
:
-
1
;
struct
esync
*
obj
=
objs
[
i
];
if
(
obj
&&
obj
->
type
==
ESYNC_MUTEX
)
{
/* If we already own the mutex, return immediately. */
/* Note: This violates the assumption that the *first* object
* to be signaled will be returned. If that becomes a problem,
* we can always check the state of each object before waiting. */
struct
mutex
*
mutex
=
(
struct
mutex
*
)
obj
;
if
(
mutex
->
tid
==
GetCurrentThreadId
())
{
TRACE
(
"Woken up by handle %p [%d].
\n
"
,
handles
[
i
],
i
);
mutex
->
count
++
;
return
i
;
}
}
fds
[
i
].
fd
=
obj
?
obj
->
fd
:
-
1
;
fds
[
i
].
events
=
POLLIN
;
}
...
...
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