~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to plugin/pbxt/src/cache_xt.cc

fix pthread atomics. operator precedence is important. The unit test now passes.

Show diffs side-by-side

added added

removed removed

Lines of Context:
14
14
 *
15
15
 * You should have received a copy of the GNU General Public License
16
16
 * along with this program; if not, write to the Free Software
17
 
 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
 
17
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18
18
 *
19
19
 * 2005-05-24   Paul McCullagh
20
20
 *
664
664
                        block->cb_data = buffer;
665
665
                        buffer += XT_INDEX_PAGE_SIZE;
666
666
#endif
667
 
#ifdef CHECK_BLOCK_TRAILERS
668
 
                        XT_SET_DISK_4(block->cp_check, 0xDEADBEEF);
669
 
#endif
670
667
                        ind_cac_globals.cg_free_list = block;
671
668
                        block++;
672
669
                }
683
680
        cont_(a);
684
681
}
685
682
 
686
 
#ifdef CHECK_BLOCK_TRAILERS
687
 
xtPublic void check_block_trailers()
688
 
{
689
 
        XTIndBlockPtr   block;
690
 
 
691
 
        block = ind_cac_globals.cg_blocks;
692
 
        for (u_int i=0; i<ind_cac_globals.cg_block_count; i++) {
693
 
                ASSERT_NS(XT_GET_DISK_4(block->cp_check) == 0xDEADBEEF);
694
 
                block++;
695
 
        }
696
 
}
697
 
#endif
698
 
 
699
683
xtPublic void xt_ind_exit(XTThreadPtr self)
700
684
{
701
685
#ifdef XT_USE_MYSYS
1272
1256
         * Conditionally count the number of deleted entries in the index:
1273
1257
         * We do this before other threads can read the block.
1274
1258
         */
1275
 
        if (ind && ind->mi_lazy_delete && read_data)
 
1259
        if (ind->mi_lazy_delete && read_data)
1276
1260
                xt_ind_count_deleted_items(ot->ot_table, ind, block);
1277
1261
 
1278
1262
        /* Add to the hash table: */
1365
1349
#ifdef XT_TRACK_INDEX_UPDATES
1366
1350
        ot->ot_ind_changed++;
1367
1351
#endif
1368
 
#ifdef CHECK_BLOCK_TRAILERS
1369
 
        check_block_trailers();
1370
 
#endif
1371
1352
        return OK;
1372
1353
}
1373
1354