Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
M
mariadb
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
mariadb
Commits
85a025f3
Commit
85a025f3
authored
Apr 12, 2012
by
Vladislav Vaintroub
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Threadpool - use EV_ONESHOT with kevent, to prevent race condition when 2
threads are retrieving events at the same time.
parent
f544b21f
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
4 additions
and
12 deletions
+4
-12
sql/threadpool_unix.cc
sql/threadpool_unix.cc
+4
-12
No files found.
sql/threadpool_unix.cc
View file @
85a025f3
...
...
@@ -295,7 +295,7 @@ int io_poll_create()
int
io_poll_start_read
(
int
pollfd
,
int
fd
,
void
*
data
)
{
struct
kevent
ke
;
EV_SET
(
&
ke
,
fd
,
EVFILT_READ
,
EV_ADD
|
EV_
ENABLE
|
EV_CLEAR
,
EV_SET
(
&
ke
,
fd
,
EVFILT_READ
,
EV_ADD
|
EV_
ONESHOT
,
0
,
0
,
data
);
return
kevent
(
pollfd
,
&
ke
,
1
,
0
,
0
,
0
);
}
...
...
@@ -303,6 +303,9 @@ int io_poll_start_read(int pollfd, int fd, void *data)
int
io_poll_associate_fd
(
int
pollfd
,
int
fd
,
void
*
data
)
{
struct
kevent
ke
;
EV_SET
(
&
ke
,
fd
,
EVFILT_READ
,
EV_ADD
|
EV_ONESHOT
,
0
,
0
,
data
);
return
io_poll_start_read
(
pollfd
,
fd
,
data
);
}
...
...
@@ -330,17 +333,6 @@ int io_poll_wait(int pollfd, struct kevent *events, int maxevents, int timeout_m
(
timeout_ms
>=
0
)
?&
ts
:
NULL
);
}
while
(
ret
==
-
1
&&
errno
==
EINTR
);
if
(
ret
>
0
)
{
/* Disable monitoring for the events we that we dequeued */
for
(
int
i
=
0
;
i
<
ret
;
i
++
)
{
struct
kevent
*
ke
=
&
events
[
i
];
EV_SET
(
ke
,
ke
->
ident
,
EVFILT_READ
,
EV_ADD
|
EV_DISABLE
,
0
,
0
,
ke
->
udata
);
}
kevent
(
pollfd
,
events
,
ret
,
0
,
0
,
0
);
}
return
ret
;
}
...
...
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