Rusty Brooks wrote:
>
> > ns_mutex lock [nsv_get sharedLock logFile]
> > nsv_append sharedLock logFile "log $line"
>
> nsv_append appends a string to an element in an nsv array, in this
>  case, sharedLock->logFile.  I do not think this is what you want.
>
> What I think you probably want is something like
>
> ns_mutex lock [nsv_get sharedLock logFile]
> log $line
> ns_mutex unlock [nsv_get sharedLock logFile]
>
> This:
> locks the mutex for logFile
> writes a line (assuming that this is what the command "log $line" does)
> unlocks the mutex, so that other threads can use this.
>
> A few extra comments:
> I found that (in admittedly, earlier versions of aolserver) I had problems
> doing something like this, because when I was writing a lot of data,
> I would end up locking, opening a file, closing a file, and unlocking
> a LOT.  I ended up doing something like having the "log" command nsv_append
> to a variable.  Every 10 minutes or so, the contents of that variable are
> appended to
> a file.  This doesn't even need a lock.  This is what I do in "production"
> systems.
> Test systems append to a file immediately so I don't have to wait 10 minutes
> to see
> my output.
>
> I really miss the ability to share files across interpreters.  Is there
> still no way to do with with AOLServer 3 and above?

there is still no way. but tcl 8.4 has facilities that make this a much easier thing
to implement.. it has a way of transferring channels between interps. that should
make things easier..

-mike

>
> Rusty

Reply via email to