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
72fc2cea
Commit
72fc2cea
authored
Jul 03, 2020
by
Alexandre Julliard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ntdll: Use pthread mutexes for uninterrupted sections in the Unix library.
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
ceeb11d2
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
17 additions
and
33 deletions
+17
-33
server.c
dlls/ntdll/unix/server.c
+7
-15
signal_i386.c
dlls/ntdll/unix/signal_i386.c
+7
-16
unix_private.h
dlls/ntdll/unix/unix_private.h
+3
-2
virtual.c
dlls/ntdll/unix/virtual.c
+0
-0
No files found.
dlls/ntdll/unix/server.c
View file @
72fc2cea
...
...
@@ -112,15 +112,7 @@ timeout_t server_start_time = 0; /* time of server startup */
sigset_t
server_block_set
;
/* signals to block during server calls */
static
int
fd_socket
=
-
1
;
/* socket to exchange file descriptors with the server */
static
pid_t
server_pid
;
static
RTL_CRITICAL_SECTION
fd_cache_section
;
static
RTL_CRITICAL_SECTION_DEBUG
critsect_debug
=
{
0
,
0
,
&
fd_cache_section
,
{
&
critsect_debug
.
ProcessLocksList
,
&
critsect_debug
.
ProcessLocksList
},
0
,
0
,
{
(
DWORD_PTR
)(
__FILE__
": fd_cache_section"
)
}
};
static
RTL_CRITICAL_SECTION
fd_cache_section
=
{
&
critsect_debug
,
-
1
,
0
,
0
,
0
,
0
};
static
pthread_mutex_t
fd_cache_mutex
=
PTHREAD_MUTEX_INITIALIZER
;
/* atomically exchange a 64-bit value */
static
inline
LONG64
interlocked_xchg64
(
LONG64
*
dest
,
LONG64
val
)
...
...
@@ -303,19 +295,19 @@ unsigned int CDECL wine_server_call( void *req_ptr )
/***********************************************************************
* server_enter_uninterrupted_section
*/
void
server_enter_uninterrupted_section
(
RTL_CRITICAL_SECTION
*
cs
,
sigset_t
*
sigset
)
void
server_enter_uninterrupted_section
(
pthread_mutex_t
*
mutex
,
sigset_t
*
sigset
)
{
pthread_sigmask
(
SIG_BLOCK
,
&
server_block_set
,
sigset
);
RtlEnterCriticalSection
(
cs
);
pthread_mutex_lock
(
mutex
);
}
/***********************************************************************
* server_leave_uninterrupted_section
*/
void
server_leave_uninterrupted_section
(
RTL_CRITICAL_SECTION
*
cs
,
sigset_t
*
sigset
)
void
server_leave_uninterrupted_section
(
pthread_mutex_t
*
mutex
,
sigset_t
*
sigset
)
{
RtlLeaveCriticalSection
(
cs
);
pthread_mutex_unlock
(
mutex
);
pthread_sigmask
(
SIG_SETMASK
,
sigset
,
NULL
);
}
...
...
@@ -1002,7 +994,7 @@ int server_get_unix_fd( HANDLE handle, unsigned int wanted_access, int *unix_fd,
ret
=
get_cached_fd
(
handle
,
&
fd
,
type
,
&
access
,
options
);
if
(
ret
!=
STATUS_INVALID_HANDLE
)
goto
done
;
server_enter_uninterrupted_section
(
&
fd_cache_
section
,
&
sigset
);
server_enter_uninterrupted_section
(
&
fd_cache_
mutex
,
&
sigset
);
ret
=
get_cached_fd
(
handle
,
&
fd
,
type
,
&
access
,
options
);
if
(
ret
==
STATUS_INVALID_HANDLE
)
{
...
...
@@ -1030,7 +1022,7 @@ int server_get_unix_fd( HANDLE handle, unsigned int wanted_access, int *unix_fd,
}
SERVER_END_REQ
;
}
server_leave_uninterrupted_section
(
&
fd_cache_
section
,
&
sigset
);
server_leave_uninterrupted_section
(
&
fd_cache_
mutex
,
&
sigset
);
done:
if
(
!
ret
&&
((
access
&
wanted_access
)
!=
wanted_access
))
...
...
dlls/ntdll/unix/signal_i386.c
View file @
72fc2cea
...
...
@@ -1934,16 +1934,7 @@ struct ldt_copy
}
__wine_ldt_copy
;
static
WORD
gdt_fs_sel
;
static
RTL_CRITICAL_SECTION
ldt_section
;
static
RTL_CRITICAL_SECTION_DEBUG
critsect_debug
=
{
0
,
0
,
&
ldt_section
,
{
&
critsect_debug
.
ProcessLocksList
,
&
critsect_debug
.
ProcessLocksList
},
0
,
0
,
{
(
DWORD_PTR
)(
__FILE__
": ldt_section"
)
}
};
static
RTL_CRITICAL_SECTION
ldt_section
=
{
&
critsect_debug
,
-
1
,
0
,
0
,
0
,
0
};
static
pthread_mutex_t
ldt_mutex
=
PTHREAD_MUTEX_INITIALIZER
;
static
const
LDT_ENTRY
null_entry
;
static
inline
void
*
ldt_get_base
(
LDT_ENTRY
ent
)
...
...
@@ -2110,10 +2101,10 @@ NTSTATUS WINAPI NtSetLdtEntries( ULONG sel1, LDT_ENTRY entry1, ULONG sel2, LDT_E
if
(
sel1
&&
(
sel1
>>
3
)
<
first_ldt_entry
)
return
STATUS_INVALID_LDT_DESCRIPTOR
;
if
(
sel2
&&
(
sel2
>>
3
)
<
first_ldt_entry
)
return
STATUS_INVALID_LDT_DESCRIPTOR
;
server_enter_uninterrupted_section
(
&
ldt_
section
,
&
sigset
);
server_enter_uninterrupted_section
(
&
ldt_
mutex
,
&
sigset
);
if
(
sel1
)
ldt_set_entry
(
sel1
,
entry1
);
if
(
sel2
)
ldt_set_entry
(
sel2
,
entry2
);
server_leave_uninterrupted_section
(
&
ldt_
section
,
&
sigset
);
server_leave_uninterrupted_section
(
&
ldt_
mutex
,
&
sigset
);
return
STATUS_SUCCESS
;
}
...
...
@@ -2165,14 +2156,14 @@ NTSTATUS signal_alloc_thread( TEB *teb )
}
else
{
server_enter_uninterrupted_section
(
&
ldt_
section
,
&
sigset
);
server_enter_uninterrupted_section
(
&
ldt_
mutex
,
&
sigset
);
for
(
idx
=
first_ldt_entry
;
idx
<
LDT_SIZE
;
idx
++
)
{
if
(
__wine_ldt_copy
.
flags
[
idx
])
continue
;
ldt_set_entry
(
(
idx
<<
3
)
|
7
,
entry
);
break
;
}
server_leave_uninterrupted_section
(
&
ldt_
section
,
&
sigset
);
server_leave_uninterrupted_section
(
&
ldt_
mutex
,
&
sigset
);
if
(
idx
==
LDT_SIZE
)
return
STATUS_TOO_MANY_THREADS
;
}
thread_data
->
fs
=
(
idx
<<
3
)
|
7
;
...
...
@@ -2193,9 +2184,9 @@ void signal_free_thread( TEB *teb )
if
(
gdt_fs_sel
)
return
;
server_enter_uninterrupted_section
(
&
ldt_
section
,
&
sigset
);
server_enter_uninterrupted_section
(
&
ldt_
mutex
,
&
sigset
);
__wine_ldt_copy
.
flags
[
thread_data
->
fs
>>
3
]
=
0
;
server_leave_uninterrupted_section
(
&
ldt_
section
,
&
sigset
);
server_leave_uninterrupted_section
(
&
ldt_
mutex
,
&
sigset
);
}
...
...
dlls/ntdll/unix/unix_private.h
View file @
72fc2cea
...
...
@@ -21,6 +21,7 @@
#ifndef __NTDLL_UNIX_PRIVATE_H
#define __NTDLL_UNIX_PRIVATE_H
#include <pthread.h>
#include "unixlib.h"
#include "wine/list.h"
...
...
@@ -162,8 +163,8 @@ extern void start_server( BOOL debug ) DECLSPEC_HIDDEN;
extern
ULONG_PTR
get_image_address
(
void
)
DECLSPEC_HIDDEN
;
extern
unsigned
int
server_call_unlocked
(
void
*
req_ptr
)
DECLSPEC_HIDDEN
;
extern
void
server_enter_uninterrupted_section
(
RTL_CRITICAL_SECTION
*
cs
,
sigset_t
*
sigset
)
DECLSPEC_HIDDEN
;
extern
void
server_leave_uninterrupted_section
(
RTL_CRITICAL_SECTION
*
cs
,
sigset_t
*
sigset
)
DECLSPEC_HIDDEN
;
extern
void
server_enter_uninterrupted_section
(
pthread_mutex_t
*
mutex
,
sigset_t
*
sigset
)
DECLSPEC_HIDDEN
;
extern
void
server_leave_uninterrupted_section
(
pthread_mutex_t
*
mutex
,
sigset_t
*
sigset
)
DECLSPEC_HIDDEN
;
extern
unsigned
int
server_select
(
const
select_op_t
*
select_op
,
data_size_t
size
,
UINT
flags
,
timeout_t
abs_timeout
,
CONTEXT
*
context
,
RTL_CRITICAL_SECTION
*
cs
,
user_apc_t
*
user_apc
)
DECLSPEC_HIDDEN
;
...
...
dlls/ntdll/unix/virtual.c
View file @
72fc2cea
This diff is collapsed.
Click to expand it.
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