~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to storage/innobase/include/sync0arr.h

  • Committer: Brian Aker
  • Date: 2008-11-04 15:39:09 UTC
  • mfrom: (575.1.2 devel)
  • Revision ID: brian@tangent.org-20081104153909-c72hn65udxs1ccal
Merge of Monty's work

Show diffs side-by-side

added added

removed removed

Lines of Context:
24
24
Creates a synchronization wait array. It is protected by a mutex
25
25
which is automatically reserved when the functions operating on it
26
26
are called. */
27
 
 
 
27
UNIV_INTERN
28
28
sync_array_t*
29
29
sync_array_create(
30
30
/*==============*/
36
36
                                of mutex protecting the data structure */
37
37
/**********************************************************************
38
38
Frees the resources in a wait array. */
39
 
 
 
39
UNIV_INTERN
40
40
void
41
41
sync_array_free(
42
42
/*============*/
44
44
/**********************************************************************
45
45
Reserves a wait array cell for waiting for an object.
46
46
The event of the cell is reset to nonsignalled state. */
47
 
 
 
47
UNIV_INTERN
48
48
void
49
49
sync_array_reserve_cell(
50
50
/*====================*/
59
59
a wait array cell. In the debug version this function checks
60
60
if the wait for a semaphore will result in a deadlock, in which
61
61
case prints info and asserts. */
62
 
 
 
62
UNIV_INTERN
63
63
void
64
64
sync_array_wait_event(
65
65
/*==================*/
66
66
        sync_array_t*   arr,    /* in: wait array */
67
67
        ulint           index);  /* in: index of the reserved cell */
68
68
/**********************************************************************
69
 
Frees the cell safely by reserving the sync array mutex and decrementing
70
 
n_reserved if necessary. Should only be called from mutex_spin_wait. */
71
 
 
 
69
Frees the cell. NOTE! sync_array_wait_event frees the cell
 
70
automatically! */
 
71
UNIV_INTERN
72
72
void
73
 
sync_array_free_cell_protected(
74
 
/*===========================*/
 
73
sync_array_free_cell(
 
74
/*=================*/
75
75
        sync_array_t*   arr,    /* in: wait array */
76
76
        ulint           index); /* in: index of the cell in array */
77
77
/**************************************************************************
78
 
Looks for the cells in the wait array which refer
79
 
to the wait object specified,
80
 
and sets their corresponding events to the signaled state. In this
81
 
way releases the threads waiting for the object to contend for the object.
82
 
It is possible that no such cell is found, in which case does nothing. */
83
 
 
 
78
Note that one of the wait objects was signalled. */
 
79
UNIV_INTERN
84
80
void
85
 
sync_array_signal_object(
86
 
/*=====================*/
87
 
        sync_array_t*   arr,    /* in: wait array */
88
 
        void*           object);/* in: wait object */
 
81
sync_array_object_signalled(
 
82
/*========================*/
 
83
        sync_array_t*   arr);   /* in: wait array */
89
84
/**************************************************************************
90
85
If the wakeup algorithm does not work perfectly at semaphore relases,
91
86
this function will do the waking (see the comment in mutex_exit). This
92
87
function should be called about every 1 second in the server. */
93
 
 
 
88
UNIV_INTERN
94
89
void
95
90
sync_arr_wake_threads_if_sema_free(void);
96
91
/*====================================*/
97
92
/**************************************************************************
98
93
Prints warnings of long semaphore waits to stderr. */
99
 
 
 
94
UNIV_INTERN
100
95
ibool
101
96
sync_array_print_long_waits(void);
102
97
/*=============================*/
105
100
/************************************************************************
106
101
Validates the integrity of the wait array. Checks
107
102
that the number of reserved cells equals the count variable. */
108
 
 
 
103
UNIV_INTERN
109
104
void
110
105
sync_array_validate(
111
106
/*================*/
112
107
        sync_array_t*   arr);   /* in: sync wait array */
113
108
/**************************************************************************
114
109
Prints info of the wait array. */
115
 
 
 
110
UNIV_INTERN
116
111
void
117
112
sync_array_print_info(
118
113
/*==================*/