Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-cw
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-cw
Commits
c8b50c98
Commit
c8b50c98
authored
Mar 11, 2019
by
Jacek Caban
Committed by
Alexandre Julliard
Mar 11, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
server: Wake waiters when new pipe server instance is created.
Signed-off-by:
Jacek Caban
<
jacek@codeweavers.com
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
be3ae013
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
79 additions
and
0 deletions
+79
-0
pipe.c
dlls/kernel32/tests/pipe.c
+78
-0
named_pipe.c
server/named_pipe.c
+1
-0
No files found.
dlls/kernel32/tests/pipe.c
View file @
c8b50c98
...
...
@@ -3808,6 +3808,83 @@ static void test_multiple_instances(void)
}
}
static
DWORD
WINAPI
wait_pipe_proc
(
void
*
arg
)
{
BOOL
ret
;
ret
=
WaitNamedPipeA
(
PIPENAME
,
1000
);
ok
(
ret
,
"WaitNamedPipe failed (%u)
\n
"
,
GetLastError
());
return
0
;
}
static
HANDLE
async_wait_pipe
(
void
)
{
HANDLE
thread
;
BOOL
ret
;
thread
=
CreateThread
(
NULL
,
0
,
wait_pipe_proc
,
NULL
,
0
,
NULL
);
ok
(
thread
!=
NULL
,
"CreateThread failed: %u
\n
"
,
GetLastError
());
ret
=
WaitNamedPipeA
(
PIPENAME
,
1
);
ok
(
!
ret
&&
GetLastError
()
==
ERROR_SEM_TIMEOUT
,
"WaitNamedPipe failed %x(%u)
\n
"
,
ret
,
GetLastError
());
return
thread
;
}
static
void
test_wait_pipe
(
void
)
{
HANDLE
server
[
2
],
client
,
wait
;
OVERLAPPED
ov
;
DWORD
res
;
BOOL
ret
;
ret
=
WaitNamedPipeA
(
PIPENAME
,
0
);
ok
(
!
ret
&&
GetLastError
()
==
ERROR_FILE_NOT_FOUND
,
"WaitNamedPipe failed %x(%u)
\n
"
,
ret
,
GetLastError
());
server
[
0
]
=
CreateNamedPipeA
(
PIPENAME
,
PIPE_ACCESS_DUPLEX
|
FILE_FLAG_OVERLAPPED
,
PIPE_READMODE_BYTE
|
PIPE_WAIT
,
ARRAY_SIZE
(
server
),
1024
,
1024
,
NMPWAIT_USE_DEFAULT_WAIT
,
NULL
);
ok
(
server
[
0
]
!=
INVALID_HANDLE_VALUE
,
"got invalid handle
\n
"
);
ret
=
WaitNamedPipeA
(
PIPENAME
,
1
);
ok
(
ret
,
"WaitNamedPipe failed (%u)
\n
"
,
GetLastError
());
client
=
CreateFileA
(
PIPENAME
,
GENERIC_READ
|
GENERIC_WRITE
,
0
,
NULL
,
OPEN_EXISTING
,
0
,
0
);
ok
(
client
!=
INVALID_HANDLE_VALUE
,
"got invalid handle
\n
"
);
/* Creating a new pipe server wakes waiters */
wait
=
async_wait_pipe
();
server
[
1
]
=
CreateNamedPipeA
(
PIPENAME
,
PIPE_ACCESS_DUPLEX
|
FILE_FLAG_OVERLAPPED
,
PIPE_READMODE_BYTE
|
PIPE_WAIT
,
ARRAY_SIZE
(
server
),
1024
,
1024
,
NMPWAIT_USE_DEFAULT_WAIT
,
NULL
);
ok
(
server
[
1
]
!=
INVALID_HANDLE_VALUE
,
"got invalid handle
\n
"
);
res
=
WaitForSingleObject
(
wait
,
100
);
ok
(
res
==
WAIT_OBJECT_0
,
"WaitForSingleObject returned %u
\n
"
,
res
);
CloseHandle
(
wait
);
CloseHandle
(
server
[
1
]);
CloseHandle
(
client
);
ret
=
DisconnectNamedPipe
(
server
[
0
]);
ok
(
ret
,
"DisconnectNamedPipe failed (%u)
\n
"
,
GetLastError
());
/* Putting pipe server into waiting listening state wakes waiters */
wait
=
async_wait_pipe
();
memset
(
&
ov
,
0
,
sizeof
(
ov
));
ov
.
hEvent
=
CreateEventW
(
NULL
,
TRUE
,
FALSE
,
NULL
);
ret
=
ConnectNamedPipe
(
server
[
0
],
&
ov
);
ok
(
ret
==
FALSE
,
"got %d
\n
"
,
ret
);
ok
(
GetLastError
()
==
ERROR_IO_PENDING
,
"got %d
\n
"
,
GetLastError
());
res
=
WaitForSingleObject
(
wait
,
100
);
ok
(
res
==
WAIT_OBJECT_0
,
"WaitForSingleObject returned %u
\n
"
,
res
);
CloseHandle
(
server
[
0
]);
res
=
WaitForSingleObject
(
ov
.
hEvent
,
0
);
ok
(
res
==
WAIT_OBJECT_0
,
"WaitForSingleObject returned %u
\n
"
,
res
);
CloseHandle
(
ov
.
hEvent
);
}
START_TEST
(
pipe
)
{
char
**
argv
;
...
...
@@ -3874,4 +3951,5 @@ START_TEST(pipe)
test_namedpipe_process_id
();
test_namedpipe_session_id
();
test_multiple_instances
();
test_wait_pipe
();
}
server/named_pipe.c
View file @
c8b50c98
...
...
@@ -1173,6 +1173,7 @@ static struct pipe_server *create_pipe_server( struct named_pipe *pipe, unsigned
}
allow_fd_caching
(
server
->
pipe_end
.
fd
);
set_fd_signaled
(
server
->
pipe_end
.
fd
,
1
);
async_wake_up
(
&
pipe
->
waiters
,
STATUS_SUCCESS
);
return
server
;
}
...
...
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