shared mem & semaphores module

Jeff Davis jdavis at empires.org
Thu Sep 19 05:08:19 EDT 2002


> 
> mmap has no provision at all for semaphores.  Try:
> 
>   http://gigue.peabody.jhu.edu/~mdboom/omi/source/shm_source/shm.html
> 
> I wish the standard library would include this.

The threading module, as someone else pointed out, includes a Semaphore 
class. It seems like it might be wrapped around locking functions in the 
thread module, however, which seems strange. The one you point to seems 
like what I'd expect in the standard library.

It's good to hear that I'm not crazy for thinking that shared memory 
functions should be in the standard library.

Which brings up an interesting question: why are python libraries not more 
categorized? It would make sense to me that instead of doing "import pg" 
you should do something more like "import db.pg" so as not to clutter the 
module namespace with 50 different database drivers (mysql, postgres, 
etc).

With that model they could make us do our imports like "import unix.shm" or 
whatever and it wouldn't get in anyone's way.

Regards,
        Jeff








More information about the Python-list mailing list