Commit 492a4f8
authored
Fix data races in lazy construction and show() (#7)
* Fix data races in lazy construction and show()
Need to always lock accesses to base_cache :)
- Forgot to lock during lazy construction in thread_cache(tid)
- Added a lock+copy to show(), to avoid holding the lock while printing
to IO, which may block arbitrarily long
* Perf improvement for Base.show: print to buffer instead of copy
Add test for show
* Add 3-arg show as well
* Fix typo in setindex: I always mix up the order of those arguments..
* Add test for different KV types1 parent 38daaea commit 492a4f8
2 files changed
+58
-4
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
88 | 88 | | |
89 | 89 | | |
90 | 90 | | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
91 | 106 | | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
92 | 125 | | |
93 | 126 | | |
94 | 127 | | |
| |||
101 | 134 | | |
102 | 135 | | |
103 | 136 | | |
104 | | - | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
105 | 140 | | |
106 | 141 | | |
107 | 142 | | |
| |||
117 | 152 | | |
118 | 153 | | |
119 | 154 | | |
120 | | - | |
121 | 155 | | |
122 | 156 | | |
123 | 157 | | |
| |||
151 | 185 | | |
152 | 186 | | |
153 | 187 | | |
154 | | - | |
| 188 | + | |
155 | 189 | | |
156 | 190 | | |
157 | | - | |
| 191 | + | |
158 | 192 | | |
159 | 193 | | |
160 | 194 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
31 | 31 | | |
32 | 32 | | |
33 | 33 | | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
34 | 48 | | |
35 | 49 | | |
36 | 50 | | |
| |||
121 | 135 | | |
122 | 136 | | |
123 | 137 | | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
124 | 144 | | |
125 | 145 | | |
126 | 146 | | |
| |||
0 commit comments