Transactional filesystem access

klacke <>
Sat Mar 13 01:38:26 CET 2004


On Fri, Mar 12, 2004 at 12:29:42PM -0300, Eduardo Figoli wrote:
>    Hi!
> 
>    I have PidA in MachineA and PidB in machineB, both linked.
> 
> 
> 
>    When PidB receives a message from PidA, PidB executes a write file
>    accesss function
>    (using file:prwrite)
> 
> 
> 
>    Suppose PidB takes T time to write to the file.
>    - What does it happens when an EXIT from PidA is received on time <T
>    (while
>    the function in PidB is still executing)?
>    Is the file parcially written in some case?



Remeber, there is never any true concurrency in the erlang runtime.
Either your process is running and writing the file, (through the
driver) or the runtime system is running (and picking up the EXIT
from the socket to node A) and the possibly killing PidB. 
However PidP will never be killed at a random time. It will always
be killed inbetween opcodes, that is: ywhile being suspended. 

EXIT signals aren't unix signals .. at all.
So, in your case either the call to file:pwrite() is done, 
or it isn't. Or to be nore correct. Either he final port_command()
in the file module is done, or it isn't.


/klacke


-- 
Claes Wikstrom                        -- Caps lock is nowhere and
http://www.hyber.org                  -- everything is under control          



More information about the erlang-questions mailing list