![]() |
checking/queueing access to file in tcl ?
hi, i started using a sql .dll in itcl for queueing access to the stats log file in a zipscript, but this is slow and mechanical (and now i got a new bug with it :X).
is there some trick to checking the status of a file with another tcl instance of zipscript, ie. zs_1 has.ioftpd.log 'open' (thus i would read this as 'locked'). zs_2 checks 'status' of .ioftpd.log, if opened by another script ('locked'), queue. zs_1 'closed' ('unlocked') .ioftpd.log zs_2 'opens' .ioftpd.log (thus 'locking' it somehow). ? any help, thx. |
If you want to lock "testfile", try and create a *new* "testfile.lock" in the same directory. Repeat (with ample sleep) until this succeeds. To unlock, simply remove the file. This method is supported by almost all configurations.
flock might be avail too http://osr5doc.ca.caldera.com:457/cg.../man?flock+TCL |
ok, then to queue ? maybe, after ms ?script script script ...?
in a loop, ? say, ? while {1} { after 1000 set a [file exists "c:/blah.log"] if {0 == $a} { break } } hmm, that should do it. what about thread safe stuff ? |
All times are GMT -5. The time now is 05:43 AM. |
Powered by vBulletin® Version 3.8.11 Alpha 3
Copyright ©2000 - 2025, vBulletin Solutions, Inc.
Parts of this site powered by vBulletin Mods & Addons from DragonByte Technologies Ltd. (Details)