|
From: Frank V. C. <fr...@co...> - 2001-09-11 10:08:09
|
Ian Crawford wrote: >On Sun, 9 Sep 2001, Frank V. Castellucci wrote: > >>To answer your first question: >> >>It is all to often we see the myopic view of the world where context >>often become part of a static type. For example, rather than take the >>time to create things like semaphore pools, a developer unilateraly >>decided that each SP type (A, B, Foo, etc.) has a single semaphore in a >>static variable. ugh. >> > >Um... I don't follow. I'm sure it's just my inexperience shining >through. > >Each SP obviously needs a (dumb) pointer and a reference count. >Modifications to these need to be thread safe, right? Now... it would be >pure evil to give each SP type a static locking mechanism. I've done it >by giving each SP instance a mutex, but is this overkill? > It is overkill, but I believe you get the idea of the semaphore (mutex) pool now. > >You mention semaphores... are you talking about implementing >mutexes/critical sections (for pointer/ref. count mods) with semaphores? >If not, I'm lost. > You are not lost, and I apologize if my phrasing isn't clear, your doing fine. > >As for semaphore pools... are you talking about something clever to avoid >my (wasteful?) "mutex for each instance" scheme? Like I said, I don't >follow. :( > You follow, this is a clever way, but has a price. > > >>And now that you brought it up (if you knew it or not with reference count): >> >>8. Reference counts must be guarded >>9. Object state must be guarded >> >>Thoughts? >> > >Does this replace #7 or is it over and above it? If the latter, then what >does #7 really mean? > Again, re-entrancy and guarded (mutex) are two different things neh? > > >[for reference...] > >>>>7. Must be re-entrent >>>> > |