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
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
nexedi
MariaDB
Commits
f12634f5
Commit
f12634f5
authored
Jul 04, 2024
by
Sergei Golubchik
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
MDEV-34530 dead code in the thr_rwlock.c
remove it
parent
7ba12d42
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
5 additions
and
170 deletions
+5
-170
configure.cmake
configure.cmake
+4
-0
mysys/thr_rwlock.c
mysys/thr_rwlock.c
+1
-170
No files found.
configure.cmake
View file @
f12634f5
...
...
@@ -414,6 +414,10 @@ CHECK_FUNCTION_EXISTS (vsnprintf HAVE_VSNPRINTF)
CHECK_FUNCTION_EXISTS
(
memalign HAVE_MEMALIGN
)
CHECK_FUNCTION_EXISTS
(
nl_langinfo HAVE_NL_LANGINFO
)
IF
(
NOT HAVE_PTHREAD_RWLOCK_RDLOCK AND NOT HAVE_RWLOCK_INIT AND NOT WIN32
)
MESSAGE
(
FATAL_ERROR
"No usable rwlock implementation found"
)
ENDIF
()
IF
(
HAVE_SYS_EVENT_H
)
CHECK_FUNCTION_EXISTS
(
kqueue HAVE_KQUEUE
)
ENDIF
()
...
...
mysys/thr_rwlock.c
View file @
f12634f5
...
...
@@ -81,176 +81,7 @@ int my_rw_destroy(my_rw_lock_t* rwp)
}
#else
/*
Source base from Sun Microsystems SPILT, simplified for MySQL use
-- Joshua Chamas
Some cleanup and additional code by Monty
*/
/*
* Multithreaded Demo Source
*
* Copyright (C) 1995 by Sun Microsystems, Inc.
*
*
* This file is a product of SunSoft, Inc. and is provided for
* unrestricted use provided that this legend is included on all
* media and as a part of the software program in whole or part.
* Users may copy, modify or distribute this file at will.
*
* THIS FILE IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING
* THE WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR
* PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE.
*
* This file is provided with no support and without any obligation on the
* part of SunSoft, Inc. to assist in its use, correction, modification or
* enhancement.
*
* SUNSOFT AND SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT
* TO THE INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY THIS
* FILE OR ANY PART THEREOF.
*
* IN NO EVENT WILL SUNSOFT OR SUN MICROSYSTEMS, INC. BE LIABLE FOR ANY
* LOST REVENUE OR PROFITS OR OTHER SPECIAL, INDIRECT AND CONSEQUENTIAL
* DAMAGES, EVEN IF THEY HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH
* DAMAGES.
*
* SunSoft, Inc.
* 2550 Garcia Avenue
* Mountain View, California 94043
*/
int
my_rw_init
(
my_rw_lock_t
*
rwp
)
{
pthread_condattr_t
cond_attr
;
pthread_mutex_init
(
&
rwp
->
lock
,
MY_MUTEX_INIT_FAST
);
pthread_condattr_init
(
&
cond_attr
);
pthread_cond_init
(
&
rwp
->
readers
,
&
cond_attr
);
pthread_cond_init
(
&
rwp
->
writers
,
&
cond_attr
);
pthread_condattr_destroy
(
&
cond_attr
);
rwp
->
state
=
0
;
rwp
->
waiters
=
0
;
#ifdef SAFE_MUTEX
rwp
->
write_thread
=
0
;
#endif
return
(
0
);
}
int
my_rw_destroy
(
my_rw_lock_t
*
rwp
)
{
DBUG_ASSERT
(
rwp
->
state
==
0
);
pthread_mutex_destroy
(
&
rwp
->
lock
);
pthread_cond_destroy
(
&
rwp
->
readers
);
pthread_cond_destroy
(
&
rwp
->
writers
);
return
(
0
);
}
int
my_rw_rdlock
(
my_rw_lock_t
*
rwp
)
{
pthread_mutex_lock
(
&
rwp
->
lock
);
/* active or queued writers */
while
((
rwp
->
state
<
0
)
||
rwp
->
waiters
)
pthread_cond_wait
(
&
rwp
->
readers
,
&
rwp
->
lock
);
rwp
->
state
++
;
pthread_mutex_unlock
(
&
rwp
->
lock
);
return
(
0
);
}
int
my_rw_tryrdlock
(
my_rw_lock_t
*
rwp
)
{
int
res
;
pthread_mutex_lock
(
&
rwp
->
lock
);
if
((
rwp
->
state
<
0
)
||
rwp
->
waiters
)
res
=
EBUSY
;
/* Can't get lock */
else
{
res
=
0
;
rwp
->
state
++
;
}
pthread_mutex_unlock
(
&
rwp
->
lock
);
return
(
res
);
}
int
my_rw_wrlock
(
my_rw_lock_t
*
rwp
)
{
pthread_mutex_lock
(
&
rwp
->
lock
);
rwp
->
waiters
++
;
/* another writer queued */
my_rw_lock_assert_not_write_owner
(
rwp
);
while
(
rwp
->
state
)
pthread_cond_wait
(
&
rwp
->
writers
,
&
rwp
->
lock
);
rwp
->
state
=
-
1
;
rwp
->
waiters
--
;
#ifdef SAFE_MUTEX
rwp
->
write_thread
=
pthread_self
();
#endif
pthread_mutex_unlock
(
&
rwp
->
lock
);
return
(
0
);
}
int
my_rw_trywrlock
(
my_rw_lock_t
*
rwp
)
{
int
res
;
pthread_mutex_lock
(
&
rwp
->
lock
);
if
(
rwp
->
state
)
res
=
EBUSY
;
/* Can't get lock */
else
{
res
=
0
;
rwp
->
state
=
-
1
;
#ifdef SAFE_MUTEX
rwp
->
write_thread
=
pthread_self
();
#endif
}
pthread_mutex_unlock
(
&
rwp
->
lock
);
return
(
res
);
}
int
my_rw_unlock
(
my_rw_lock_t
*
rwp
)
{
DBUG_PRINT
(
"rw_unlock"
,
(
"state: %d waiters: %d"
,
rwp
->
state
,
rwp
->
waiters
));
pthread_mutex_lock
(
&
rwp
->
lock
);
DBUG_ASSERT
(
rwp
->
state
!=
0
);
if
(
rwp
->
state
==
-
1
)
/* writer releasing */
{
my_rw_lock_assert_write_owner
(
rwp
);
rwp
->
state
=
0
;
/* mark as available */
#ifdef SAFE_MUTEX
rwp
->
write_thread
=
0
;
#endif
if
(
rwp
->
waiters
)
/* writers queued */
pthread_cond_signal
(
&
rwp
->
writers
);
else
pthread_cond_broadcast
(
&
rwp
->
readers
);
}
else
{
if
(
--
rwp
->
state
==
0
&&
/* no more readers */
rwp
->
waiters
)
pthread_cond_signal
(
&
rwp
->
writers
);
}
pthread_mutex_unlock
(
&
rwp
->
lock
);
return
(
0
);
}
#error no pthread_rwlock_init
#endif
/* !defined _WIN32 */
#endif
/* NEED_MY_RW_LOCK*/
...
...
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