~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to storage/innobase/sync/sync0rw.c

  • Committer: Monty Taylor
  • Date: 2008-10-02 01:27:37 UTC
  • Revision ID: monty@inaugust.com-20081002012737-3uxmdovii2l14uqe
Removed unused crud.

Show diffs side-by-side

added added

removed removed

Lines of Context:
16
16
#include "srv0srv.h"
17
17
 
18
18
/* number of system calls made during shared latching */
19
 
UNIV_INTERN ulint       rw_s_system_call_count  = 0;
 
19
ulint   rw_s_system_call_count  = 0;
20
20
 
21
21
/* number of spin waits on rw-latches,
22
22
resulted during shared (read) locks */
23
 
UNIV_INTERN ulint       rw_s_spin_wait_count    = 0;
 
23
ulint   rw_s_spin_wait_count    = 0;
24
24
 
25
25
/* number of OS waits on rw-latches,
26
26
resulted during shared (read) locks */
27
 
UNIV_INTERN ulint       rw_s_os_wait_count      = 0;
 
27
ulint   rw_s_os_wait_count      = 0;
28
28
 
29
29
/* number of unlocks (that unlock shared locks),
30
30
set only when UNIV_SYNC_PERF_STAT is defined */
31
 
UNIV_INTERN ulint       rw_s_exit_count         = 0;
 
31
ulint   rw_s_exit_count         = 0;
32
32
 
33
33
/* number of system calls made during exclusive latching */
34
 
UNIV_INTERN ulint       rw_x_system_call_count  = 0;
 
34
ulint   rw_x_system_call_count  = 0;
35
35
 
36
36
/* number of spin waits on rw-latches,
37
37
resulted during exclusive (write) locks */
38
 
UNIV_INTERN ulint       rw_x_spin_wait_count    = 0;
 
38
ulint   rw_x_spin_wait_count    = 0;
39
39
 
40
40
/* number of OS waits on rw-latches,
41
41
resulted during exclusive (write) locks */
42
 
UNIV_INTERN ulint       rw_x_os_wait_count      = 0;
 
42
ulint   rw_x_os_wait_count      = 0;
43
43
 
44
44
/* number of unlocks (that unlock exclusive locks),
45
45
set only when UNIV_SYNC_PERF_STAT is defined */
46
 
UNIV_INTERN ulint       rw_x_exit_count         = 0;
 
46
ulint   rw_x_exit_count         = 0;
47
47
 
48
48
/* The global list of rw-locks */
49
 
UNIV_INTERN rw_lock_list_t      rw_lock_list;
50
 
UNIV_INTERN mutex_t             rw_lock_list_mutex;
 
49
rw_lock_list_t  rw_lock_list;
 
50
mutex_t         rw_lock_list_mutex;
51
51
 
52
52
#ifdef UNIV_SYNC_DEBUG
53
53
/* The global mutex which protects debug info lists of all rw-locks.
54
54
To modify the debug info list of an rw-lock, this mutex has to be
55
55
acquired in addition to the mutex protecting the lock. */
56
56
 
57
 
UNIV_INTERN mutex_t             rw_lock_debug_mutex;
58
 
/* If deadlock detection does not get immediately the mutex,
59
 
it may wait for this event */
60
 
UNIV_INTERN os_event_t          rw_lock_debug_event;
61
 
/* This is set to TRUE, if there may be waiters for the event */
62
 
UNIV_INTERN ibool               rw_lock_debug_waiters;
 
57
mutex_t         rw_lock_debug_mutex;
 
58
os_event_t      rw_lock_debug_event;    /* If deadlock detection does not
 
59
                                        get immediately the mutex, it may
 
60
                                        wait for this event */
 
61
ibool           rw_lock_debug_waiters;  /* This is set to TRUE, if there may
 
62
                                        be waiters for the event */
63
63
 
64
64
/**********************************************************************
65
65
Creates a debug info struct. */
102
102
location (which must be appropriately aligned). The rw-lock is initialized
103
103
to the non-locked state. Explicit freeing of the rw-lock with rw_lock_free
104
104
is necessary only if the memory block containing it is freed. */
105
 
UNIV_INTERN
 
105
 
106
106
void
107
107
rw_lock_create_func(
108
108
/*================*/
151
151
        lock->last_x_file_name = "not yet reserved";
152
152
        lock->last_s_line = 0;
153
153
        lock->last_x_line = 0;
154
 
        lock->event = os_event_create(NULL);
155
 
 
156
 
#ifdef __WIN__
157
 
        lock->wait_ex_event = os_event_create(NULL);
158
 
#endif
159
154
 
160
155
        mutex_enter(&rw_lock_list_mutex);
161
156
 
173
168
Calling this function is obligatory only if the memory buffer containing
174
169
the rw-lock is freed. Removes an rw-lock object from the global list. The
175
170
rw-lock is checked to be in the non-locked state. */
176
 
UNIV_INTERN
 
171
 
177
172
void
178
173
rw_lock_free(
179
174
/*=========*/
189
184
        mutex_free(rw_lock_get_mutex(lock));
190
185
 
191
186
        mutex_enter(&rw_lock_list_mutex);
192
 
        os_event_free(lock->event);
193
 
 
194
 
#ifdef __WIN__
195
 
        os_event_free(lock->wait_ex_event);
196
 
#endif
197
187
 
198
188
        if (UT_LIST_GET_PREV(list, lock)) {
199
189
                ut_a(UT_LIST_GET_PREV(list, lock)->magic_n == RW_LOCK_MAGIC_N);
211
201
/**********************************************************************
212
202
Checks that the rw-lock has been initialized and that there are no
213
203
simultaneous shared and exclusive locks. */
214
 
UNIV_INTERN
 
204
 
215
205
ibool
216
206
rw_lock_validate(
217
207
/*=============*/
242
232
locked in exclusive mode, or there is an exclusive lock request waiting,
243
233
the function spins a preset time (controlled by SYNC_SPIN_ROUNDS), waiting
244
234
for the lock, before suspending the thread. */
245
 
UNIV_INTERN
 
235
 
246
236
void
247
237
rw_lock_s_lock_spin(
248
238
/*================*/
334
324
thread is able to acquire a second x-latch which is stored in an mtr.
335
325
This, in turn, is needed to pass the debug checks of index page
336
326
operations. */
337
 
UNIV_INTERN
 
327
 
338
328
void
339
329
rw_lock_x_lock_move_ownership(
340
330
/*==========================*/
461
451
on the rw-lock, locking succeed, with the following exception: if pass != 0,
462
452
only a single x-lock may be taken on the lock. NOTE: If the same thread has
463
453
an s-lock, locking does not succeed! */
464
 
UNIV_INTERN
 
454
 
465
455
void
466
456
rw_lock_x_lock_func(
467
457
/*================*/
554
544
        rw_x_system_call_count++;
555
545
 
556
546
        sync_array_reserve_cell(sync_primary_wait_array,
557
 
                                lock,
558
 
#ifdef __WIN__
559
 
                                /* On windows RW_LOCK_WAIT_EX signifies
560
 
                                that this thread should wait on the
561
 
                                special wait_ex_event. */
562
 
                                (state == RW_LOCK_WAIT_EX)
563
 
                                 ? RW_LOCK_WAIT_EX :
564
 
#endif
565
 
                                RW_LOCK_EX,
 
547
                                lock, RW_LOCK_EX,
566
548
                                file_name, line,
567
549
                                &index);
568
550
 
593
575
mutex protecting the sync array, and the ordinary mutex_enter might
594
576
recursively call routines in sync0arr, leading to a deadlock on the OS
595
577
mutex. */
596
 
UNIV_INTERN
 
578
 
597
579
void
598
580
rw_lock_debug_mutex_enter(void)
599
581
/*==========================*/
618
600
 
619
601
/**********************************************************************
620
602
Releases the debug mutex. */
621
 
UNIV_INTERN
 
603
 
622
604
void
623
605
rw_lock_debug_mutex_exit(void)
624
606
/*==========================*/
633
615
 
634
616
/**********************************************************************
635
617
Inserts the debug information for an rw-lock. */
636
 
UNIV_INTERN
 
618
 
637
619
void
638
620
rw_lock_add_debug_info(
639
621
/*===================*/
669
651
 
670
652
/**********************************************************************
671
653
Removes a debug information struct for an rw-lock. */
672
 
UNIV_INTERN
 
654
 
673
655
void
674
656
rw_lock_remove_debug_info(
675
657
/*======================*/
716
698
/**********************************************************************
717
699
Checks if the thread has locked the rw-lock in the specified mode, with
718
700
the pass value == 0. */
719
 
UNIV_INTERN
 
701
 
720
702
ibool
721
703
rw_lock_own(
722
704
/*========*/
756
738
 
757
739
/**********************************************************************
758
740
Checks if somebody has locked the rw-lock in the specified mode. */
759
 
UNIV_INTERN
 
741
 
760
742
ibool
761
743
rw_lock_is_locked(
762
744
/*==============*/
792
774
#ifdef UNIV_SYNC_DEBUG
793
775
/*******************************************************************
794
776
Prints debug info of currently locked rw-locks. */
795
 
UNIV_INTERN
 
777
 
796
778
void
797
779
rw_lock_list_print_info(
798
780
/*====================*/
845
827
 
846
828
/*******************************************************************
847
829
Prints debug info of an rw-lock. */
848
 
UNIV_INTERN
 
830
 
849
831
void
850
832
rw_lock_print(
851
833
/*==========*/
878
860
 
879
861
/*************************************************************************
880
862
Prints info of a debug struct. */
881
 
UNIV_INTERN
 
863
 
882
864
void
883
865
rw_lock_debug_print(
884
866
/*================*/
909
891
/*******************************************************************
910
892
Returns the number of currently locked rw-locks. Works only in the debug
911
893
version. */
912
 
UNIV_INTERN
 
894
 
913
895
ulint
914
896
rw_lock_n_locked(void)
915
897
/*==================*/