file locking primitive

Cees de Groot cg at tric.nl
Sat Jan 3 10:07:30 UTC 2004


Julian Fitzell  <squeak-dev at lists.squeakfoundation.org> said:
>This has come up before but we need the file locking primitive in Squeak 
>to support our work in OmniBase.  There has been enough interest in this 
>in the past that I think it's worthwhile coming up with a primitive 
>interface that is implementable in all the common VMs.
>
This week, I spent some work on the latest version of OmniBase which now
has an FFI-based file class for Win32 that implements locking, share
modes, and some other things (Win32 atomic writes). 

I'm using that class as a template to write an equivalent Posix class so
that file locking will work on the two main platforms (Win32 and Posix,
with the remark that my code uses both lockf() and flock() so it expects
some BSD extensions to be present as well). On all other platforms,
OmniBase will fall back to a 'lock-less' version but will still do
internal locking, so OmniBase should be safe to use on any platform
unless you want to access a single database from multiple Squeak
instances on a platform where locking is not supported.

When this works, I was planning to rewrite the FFI stuff for Posix into
a file I/O plugin; this work is (IMO) necessary anyway on Posix hosts
because Squeak currently uses the stdio library, which is an unnecessary
layer. This will leave Squeak with two methods for I/O: a 'basic one' in
the VM core, and an 'enhanced one' in a plug-in that can be used by
people wanting to write application servers, database servers, etcetera.

-- 
Cees de Groot               http://www.tric.nl     <cg at tric.nl>
tric, the new way           helpdesk/ticketing software, VoIP/CTI, 
                            web applications, custom development




More information about the Squeak-dev mailing list