> Hong Zhang wrote: > > > This code should NEVER work, period. People will just ask for trouble > > with this kind of code. > > Actually I meant to have specified ">>" as the mode, i.e. append, then > what I originally said holds true. This behaviour is predictable and > dependable in the current perl implementation. Without the >> the file > will contain just "bar\n". That was not what I meant. Your code already assume the existence of reference counting. It does not work well with any other kind of garbage collection. If you translate the same code into C without putting in the close(), the code will not work at all. By the way, in order to use perl in real native thread systems, we have to use atomic operation for increment/decrement reference count. On most systems I have measured (pc and sparc), any atomic operation takes about 0.1-0.3 micro second, and it will be even worse on large SMP machines. The latest garbage collection algorithms (parallel and cocurrent) can handle large memory pretty well. The cost will be less DF. HongThread Previous | Thread Next