History log of /frameworks/compile/libbcc/lib/ExecutionEngine/FileHandle.h
Revision Date Author Comments (<<< Hide modified files) (Show modified files >>>)
758d00c68b5bb43ed8062563bdd55285b883e8ca 03-May-2012 Stephen Hines <srhines@google.com> Revert "Introduce InputFile/OutputFile and FileMutex."

This reverts commit d670be7a08cb85329ff3b5e9039cda9ffa4a35a1.

Conflicts:

lib/ExecutionEngine/InputFile.cpp
lib/ExecutionEngine/OutputFile.cpp

Change-Id: I99d5ed4cbda7296a399d683dfa264ce68bc4ddf3
/frameworks/compile/libbcc/lib/ExecutionEngine/FileHandle.h
d670be7a08cb85329ff3b5e9039cda9ffa4a35a1 05-Apr-2012 Zonr Chang <zonr.net@gmail.com> Introduce InputFile/OutputFile and FileMutex.

FileHandle is replaced with InputFile/OutputFile and FileMutex.

Use InputFile when you want to open a file in read-only.
USe OutputFile when you open a file for writing.
Both of them provide a reliable way to access the files and perform
the I/O operations.

Given a name "foo", FileMutex creates a file named "foo.lock" and
tries to acquire an advisory lock (flock) on this file.

FileHandle, which uses the file it's openning for locking, may corrupt
the file contents when two or more processes are trying to gain the
lock for reading/writing. For example:

Process #2 creates foo
Process #1 opens foo
Process #2 opens foo
Process #2 locks foo (exclusively) (success)
Process #1 locks foo (failed, retry #1)
Process #2 starts writing foo
Process #1 opens and truncates foo (note there’s O_TRUNC in the flag)
Process #2 writes foo continually (foo is corrupted from now on ...)
Process #1 locks foo (failed, retry #2)
...
Process #1 locks foo (reach the max retries and return)
Process #2 gets done on writing foo (foo is corrupted ...)
Process #2 unlocks and closes foo (foo is corrupted)
/frameworks/compile/libbcc/lib/ExecutionEngine/FileHandle.h
45e84be0bbe39c5e08e1c2a45c62e09c9dcd0582 27-Feb-2011 Logan <tzuhsiang.chien@gmail.com> Rename bcc -> ExecutionEngine , runtime -> ScriptCRT
/frameworks/compile/libbcc/lib/ExecutionEngine/FileHandle.h