Ack! Indeed, the hazards of using gmail as your IDE.
Should be this:
```javascript
var fd = fs.openSync("foo.txt", "r")
var buf = new Buffer(fs.statSync("foo.txt").size)
buf.fill(0)
fs.read(fd, buf, 0, buf.length, 0, function () {
throw new Error("This will never be called")
})
while (true) { // loop goes forever, jealously holding onto this tick
for (var i = 0; i < buf.length; i ++) {
// I sure hope there are no break-ins...
if (buf[i] !== 0) {
throw new Error("HIDE YA KIDS, HIDE YA WIFE")
// todo: Hide ya husbands too. They takin e'rbody up in here.
}
}
}
```
On Thu, Mar 15, 2012 at 14:38, Marcin Zawadzki <[email protected]> wrote:
> Hi Isaac
>
> actually you are right, except that you have a bug in your example. Callig
> fs.read() function takes 6 arguments, not 5 as you wrote. So you forgot
> probably to pass second parameter which should be the buffer. So for people
> reding your code it is not clear how the buffer could be changed in another
> thread, but it really happens.
>
> Marcin
>
> --
> Job Board: http://jobs.nodejs.org/
> Posting guidelines:
> https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
> You received this message because you are subscribed to the Google
> Groups "nodejs" group.
> To post to this group, send email to [email protected]
> To unsubscribe from this group, send email to
> [email protected]
> For more options, visit this group at
> http://groups.google.com/group/nodejs?hl=en?hl=en
--
Job Board: http://jobs.nodejs.org/
Posting guidelines:
https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
You received this message because you are subscribed to the Google
Groups "nodejs" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/nodejs?hl=en?hl=en