[Tutor] O_EXLOCK ?

Andrew McNamara andrewm at object-craft.com.au
Tue Jan 6 02:28:10 EST 2004


>agreed, but oops, i shoud have said that i found the situation problematic 
>only at file creation time.  When a file already exists and contains pickled 
>data there's no problem and fcntl locking permits that the file stays in a 
>consistent state (for pickle).  
>
>when a file is to be created and process A (wanting to dump a pickled object)
>and B (wanting to read a pickled object) are competing, there's the possibility
>that B gain the lock and start reading just after A has created the file - 
>then pickle in B will raise an EOFError (or something).  I was concerned by
>this.
>
>but i can dump my object to a temporary file, and then link(2), this looks ok
>for my needs.

Yep, under unix, that would be your best bet.

-- 
Andrew McNamara, Senior Developer, Object Craft
http://www.object-craft.com.au/



More information about the Tutor mailing list