Go Back   FlashFXP Forums > Community Chatter > Programming

Programming Need help with C/C++/Delphi? Ask here and make us all laugh.

Closed Thread
 
Thread Tools Rate Thread
Old 10-26-2003, 09:33 AM   #1
Senior Member
 
Join Date: Feb 2003
Posts: 488
Unhappy 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.
b>d>>s is offline  
Old 10-26-2003, 11:16 AM   #2
Posse Member
Ultimate Scripter
ioFTPD Administrator
 
Join Date: Dec 2002
Posts: 2,022
Default

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
Mouton is offline  
Old 10-26-2003, 11:46 AM   #3
Senior Member
 
Join Date: Feb 2003
Posts: 488
Default

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 ?
b>d>>s is offline  
Closed Thread
Create a free account to browse our forums without ads



Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
No Route to Host Don General Discussions 1 08-22-2004 10:07 PM


All times are GMT -5. The time now is 12:10 PM.