]>
Commit | Line | Data |
---|---|---|
81f80d8c MF |
1 | typedef unsigned long int ulint; |
2 | typedef long int lint; | |
3 | typedef struct rw_lock_struct rw_lock_t; | |
4 | struct rw_lock_struct { | |
5 | volatile lint lock_word; | |
6 | volatile ulint reader_count; | |
7 | volatile ulint writer; | |
8 | }; | |
9 | static inline ulint rw_lock_x_lock_func_nowait(rw_lock_t * lock, | |
10 | const char *file_name, | |
11 | ulint line) | |
12 | { | |
13 | if (lock->reader_count == 0) { | |
14 | if (__sync_lock_test_and_set(&(lock->writer), 351) == 350) { | |
15 | retry_x_lock:if (__sync_sub_and_fetch(&(lock->lock_word), 0x00100000) | |
16 | == 0) { | |
17 | if (__sync_fetch_and_add | |
18 | (&(lock->lock_word), 0x00100000) == 0) | |
19 | goto retry_x_lock; | |
20 | } | |
21 | } | |
22 | } | |
23 | } | |
24 | ||
25 | typedef struct mtr_struct mtr_t; | |
26 | typedef struct buf_block_struct buf_block_t; | |
27 | typedef unsigned char buf_frame_t; | |
28 | struct buf_block_struct { | |
29 | rw_lock_t lock; | |
30 | struct { | |
31 | } awe_LRU_free_mapped; | |
32 | }; | |
33 | buf_frame_t *buf_page_get_gen(ulint space, ulint offset, ulint rw_latch, | |
34 | buf_frame_t * guess, ulint mode, const char *file, | |
35 | ulint line, mtr_t * mtr) | |
36 | { | |
37 | buf_block_t *block; | |
38 | ulint success; | |
39 | if (mode == 12) { | |
40 | if (rw_latch == 1) { | |
41 | success = | |
42 | rw_lock_x_lock_func_nowait(&(block->lock), file, | |
43 | line); | |
44 | } | |
45 | } | |
46 | } |