tech-userlevel archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: Semantics of copying mutex/rwlock



> What I do is call pthread_mutex_destroy() on every old lock, allocate
> a new array, call pthread_mutex_init() on all locks in new array and
> then free old array.  I guess there is no way around it.

There is, actually - you could use an array of pthread_mutex_t *, with
the mutexes themselves allocated separately and individually.  It means
more allocations and complicated allocation code, it might be worth it.

/~\ The ASCII                             Mouse
\ / Ribbon Campaign
 X  Against HTML                mouse%rodents-montreal.org@localhost
/ \ Email!           7D C8 61 52 5D E7 2D 39  4E F1 31 3E E8 B3 27 4B


Home | Main Index | Thread Index | Old Index