Revert "Settled race condition TODOs across all platforms... as an unfortunate case :("

Things broke when introducing this after the new GC... let's see if this broke under the new GC or not.

This reverts commit b198a4dfec.
This commit is contained in:
Pietro Gagliardi 2014-08-11 17:18:02 -04:00
parent 2c7c8b3a6b
commit 67adbd43a1
3 changed files with 17 additions and 29 deletions

View File

@ -36,15 +36,11 @@ func finishNewTable(b *tablebase, ty reflect.Type) Table {
func (t *table) Unlock() { func (t *table) Unlock() {
t.unlock() t.unlock()
// there's a possibility that user actions can happen at this point, before the view is updated // TODO RACE CONDITION HERE
// alas, this is something we have to deal with, because Unlock() can be called from any thread // not sure about this one...
go func() { t.RLock()
Do(func() { defer t.RUnlock()
t.RLock() C.tableUpdate(t._id)
defer t.RUnlock()
C.tableUpdate(t._id)
})
}()
} }
//export goTableDataSource_getValue //export goTableDataSource_getValue

View File

@ -58,17 +58,13 @@ func (t *table) Lock() {
func (t *table) Unlock() { func (t *table) Unlock() {
t.unlock() t.unlock()
// there's a possibility that user actions can happen at this point, before the view is updated // TODO RACE CONDITION HERE
// alas, this is something we have to deal with, because Unlock() can be called from any thread // not sure about this one...
go func() { t.RLock()
Do(func() { defer t.RUnlock()
t.RLock() d := reflect.Indirect(reflect.ValueOf(t.data))
defer t.RUnlock() new := C.gint(d.Len())
d := reflect.Indirect(reflect.ValueOf(t.data)) C.tableUpdate(t.model, t.old, new)
new := C.gint(d.Len())
C.tableUpdate(t.model, t.old, new)
})
}()
} }
//export goTableModel_get_n_columns //export goTableModel_get_n_columns

View File

@ -38,15 +38,11 @@ func finishNewTable(b *tablebase, ty reflect.Type) Table {
func (t *table) Unlock() { func (t *table) Unlock() {
t.unlock() t.unlock()
// there's a possibility that user actions can happen at this point, before the view is updated // TODO RACE CONDITION HERE
// alas, this is something we have to deal with, because Unlock() can be called from any thread // I think there's a way to set the item count without causing a refetch of data that works around this...
go func() { t.RLock()
Do(func() { defer t.RUnlock()
t.RLock() C.tableUpdate(t._hwnd, C.int(reflect.Indirect(reflect.ValueOf(t.data)).Len()))
defer t.RUnlock()
C.tableUpdate(t._hwnd, C.int(reflect.Indirect(reflect.ValueOf(t.data)).Len()))
})
}()
} }
//export tableGetCellText //export tableGetCellText