I have looked at : https://github.com/rainycape/vfs

and I am trying to understand and predict what to be expected from the VFS
when I will be using io.Copy on a file.

The VFS has a lock on a file but from what I have seen until now in the
source code it locks the file on a "read' operation but it releases the lock
with a defer on a read.

I am trying to predict if I would need to "lock" the whole file manually as
long as I want it to be or not.

I have seen the sources of io.Copy which led me to:
https://golang.org/src/io/io.go?s=12235:12295#L366

And it seems that the read is being used in a loop with couple basic exit
states.

Between these read operations, there is a state which the file would not
stay in under a "read" operation which allows the vfs file to be unlocked.

 

Would any lower level of the language will "assume" that the file will be
"unlocked"(since the read operation ended) at runtime or
it will be considered or optimized to be a single long "read" operation and
by that will allow me to count on the VFS lock?

As I am writing myself I feel like I have the answer already but I need more
eyes to ease my mind.

 

Thanks,

Eliezer

 

----

Eliezer Croitoru <http://ngtech.co.il/lmgtfy/> 
Linux System Administrator
Mobile: +972-5-28704261
Email: elie...@ngtech.co.il



 

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to