Outcurses: Difference between revisions
| Line 241: | Line 241: | ||
Growlight resolved this by requiring ncurses events to take the core lock before taking the ncurses lock. This requires cooperation from the core and a simplistic locking scheme, and serializes most of the program against the UI, but does resolve the problem. Omphalos appears not to lock the core from within the UI. Instead, the UI carries around significant copied data—enough to establish the number of lines an interface can require at any given time, though not enough to redraw the interface details. At some point, the omphalos UI takes a deep breath and dereferences a pointer into unlocked application-side data. This can be made to work only if the UI copies all metadata necessary for structuring the output, AND can rely on the core neither moving nor deleting | Growlight resolved this by requiring ncurses events to take the core lock before taking the ncurses lock. This requires cooperation from the core and a simplistic locking scheme, and serializes most of the program against the UI, but does resolve the problem. Omphalos appears not to lock the core from within the UI. Instead, the UI carries around significant copied data—enough to establish the number of lines an interface can require at any given time, though not enough to redraw the interface details. At some point, the omphalos UI takes a deep breath and dereferences a pointer into unlocked application-side data. This can be made to work only if the UI copies all metadata necessary for structuring the output, AND can rely on the core neither moving nor deleting | ||
data to which the UI points without taking the UI lock. In omphalos, for instance, receipt of an <tt>RTM_DELLINK</tt> [[netlink]] message indicating that an interface has been deleted is handled thus: | data to which the UI points without taking the UI lock. In omphalos, for instance, receipt of an <tt>RTM_DELLINK</tt> [[netlink]] message indicating that an interface has been deleted is handled thus (all in the context of the thread receiving the netlink event): | ||
<ul> | <ul> | ||
| Line 258: | Line 258: | ||
<li>repairing the screen by filling in this hole, possibly making other ifaces visible</li> | <li>repairing the screen by filling in this hole, possibly making other ifaces visible</li> | ||
<li>releasing the UI lock</li> | <li>releasing the UI lock</li> | ||
<li>releasing the iface lock</li> | <li>releasing the core's iface lock</li> | ||
<li>destroying the <tt>interface</tt></li> | <li>destroying the <tt>interface</tt></li> | ||
</ul> | </ul> | ||