@@ -195,9 +195,9 @@ uint32_t SystemProperties::ReadMutablePropertyValue(const prop_info* pi, char* v
195
195
serial = new_serial;
196
196
len = SERIAL_VALUE_LEN (serial);
197
197
if (__predict_false (SERIAL_DIRTY (serial))) {
198
- // See the comment in the prop_area constructor.
199
- prop_area* pa = contexts_-> GetPropAreaForName ( pi ->name );
200
- memcpy (value, pa-> dirty_backup_area (), len + 1 ) ;
198
+ __futex_wait ( const_cast < atomic_uint_least32_t *>(& pi -> serial ), serial, nullptr );
199
+ new_serial = load_const_atomic (& pi ->serial , memory_order_relaxed );
200
+ continue ;
201
201
} else {
202
202
memcpy (value, pi ->value , len + 1 );
203
203
}
@@ -300,17 +300,6 @@ int SystemProperties::Update(prop_info* pi, const char* value, unsigned int len)
300
300
auto * override_pi = const_cast <prop_info*>(have_override ? override_pa->find (pi ->name ) : nullptr );
301
301
302
302
uint32_t serial = atomic_load_explicit (&pi ->serial , memory_order_relaxed);
303
- unsigned int old_len = SERIAL_VALUE_LEN (serial);
304
-
305
- // The contract with readers is that whenever the dirty bit is set, an undamaged copy
306
- // of the pre-dirty value is available in the dirty backup area. The fence ensures
307
- // that we publish our dirty area update before allowing readers to see a
308
- // dirty serial.
309
- memcpy (pa->dirty_backup_area (), pi ->value , old_len + 1 );
310
- if (have_override) {
311
- memcpy (override_pa->dirty_backup_area (), override_pi->value , old_len + 1 );
312
- }
313
- atomic_thread_fence (memory_order_release);
314
303
serial |= 1 ;
315
304
atomic_store_explicit (&pi ->serial , serial, memory_order_relaxed);
316
305
strncpy (pi ->value , value, PROP_VALUE_MAX);
0 commit comments