On 2008-07-23 at 10:20:44 [+0200], Salvatore Benedetto <emitrax@xxxxxxxxx> wrote: > 2008/7/14 Ingo Weinhold <ingo_weinhold@xxxxxx>: > >> As for the SEM_UNDO feature, it hasn't been yet added because honestly I > >> haven't > >> understand it yet, but I'll look more into it. > > > > It's not that complicated. The basic idea is that for each team the > > changes > > to each semaphore need to be summed up. When the team exits the changes > > need > > to be reverted. > > > > While I'm testing the implementation, this seems to be the last missing > feature. > > Any hints on how to implement this? First of all you need a structure you can attach to a the struct team, when it uses XSI semaphores. You can do that as it is done for the POSIX semaphores. Search in src/system/kernel/team.cpp (and .../posix/realtime_sem.cpp) for "realtime_sem_context" to see how. The structure should track all anonymous semaphores, so that they can be deleted automatically when the team terminates or exec*()s, and for each semaphore for which the SEM_UNDO feature has been used you have to track the value to undo. On team termination (or exec*()) the undo values are applied. It probably also makes sense to put the undo structures in a list associated with the semaphore set, so that the structures can be deleted when the semaphore set is deleted. Care must be taken to avoid race conditions when accessing the per-team structure. > By the way, bonnie++ after the latest commits, rans just fine in > single process mode. Excellent! :-) CU, Ingo