Go Back   FlashFXP Forums > >

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

Closed Thread
 
Thread Tools Rate Thread Display Modes
Old 11-20-2003, 10:20 PM   #1
b>d>>s
Senior Member
 
Join Date: Feb 2003
Posts: 488
Default iTCL background routines possible?

is there a way to run some tcl in the background on io?, kinda like how dzsbot runs on utimer in eggdrop?

allowing io to continue normally ?


thanks
b>d>>s is offline  
Old 11-20-2003, 11:59 PM   #2
darkone
Disabled
FlashFXP Registered User
ioFTPD Administrator
 
darkone's Avatar
 
Join Date: Dec 2001
Posts: 2,230
Default

Setup timer from itcl...
darkone is offline  
Old 11-21-2003, 05:51 AM   #3
phoenixfr
Senior Member
 
Join Date: Nov 2001
Posts: 149
Default

io can crash with those comands !?

dark0ne if that's true is there anything possible to make io crash proof with this

just don't like the idea that it's possible to crash
phoenixfr is offline  
Old 11-21-2003, 07:36 AM   #4
darkone
Disabled
FlashFXP Registered User
ioFTPD Administrator
 
darkone's Avatar
 
Join Date: Dec 2001
Posts: 2,230
Default

With what commands? I can't protect tcl interpreter (if it crashes on invalid commands), as it's nothing but 3rd party add-on.
darkone is offline  
Old 11-21-2003, 11:19 AM   #5
b>d>>s
Senior Member
 
Join Date: Feb 2003
Posts: 488
Default

ah,cool. works. i thought timer just executed 'once', but it repeats over and over .. neat



thx
b>d>>s is offline  
Old 11-21-2003, 01:25 PM   #6
darkone
Disabled
FlashFXP Registered User
ioFTPD Administrator
 
darkone's Avatar
 
Join Date: Dec 2001
Posts: 2,230
Default

Hmms, it shouldn't execute more than once per command You need to recall timer once per script run... so something like this should work:


mytimerscript.itcl

# do stuff
...
# stuff done

timer "TCL mytimerscript.itcl"


also you could protect your timer, so that there won't be multiple instances... here's a working hack, using spinlock - it might crash, if timer is stopped twice


proc mytimer_do { wo } {
putlog "timer is running"
timer 1000 "TCL ../scripts/timertest.itcl -timer $wo"
}


proc mytimer { wo } {
# Set status to unsignaled & return current status (0 = signaled, 1 = unsignaled)
if {[waitobject reset $wo]} {
# Timer has not been canceled
mytimer_do $wo
return
}
putlog "closing timer"
# Close waitobject permanently
waitobject delete $wo
return
}


if {[info exists args]} {
set argv [split $args]
# "-timer" is called by timer
if {[lindex $argv 0] == "-timer"} {
mytimer [lindex $argv 1]
return 0
}

# "-stop" is a parameter that stops the timer, on next timer instance
if {[lindex $argv 0] == "-stop"} {
set wo [waitobject open "myprotector" spinlock]
if {$wo} {
# Set status to signaled
putlog "Stopping timer"
if {[waitobject set $wo]} {
# Could not acquire lock, this means timer is running
iputs "Stopping timer"
} else {
# Acquired lock, this means that waitobject didn't exist
#
waitobject delete $wo
}
waitobject close $wo
}
return 0
}
}


# Open named spinlock
set wo [waitobject open "myprotector" "spinlock"]
if {$wo} {
# Spinlock open, wait - max 1spin (if lock can't be instantly acquired, timer already exists)
if {[waitobject wait $wo 0] == 0} {
# Acquired lock
iputs "Setting up new timer!"
mytimer_do $wo
} else {
# Timer is already running
iputs "Timer already running!"
}
waitobject close $wo
return 0
} else {
# Couldn't create spinlock
return 1
}
darkone is offline  
Old 11-21-2003, 01:50 PM   #7
b>d>>s
Senior Member
 
Join Date: Feb 2003
Posts: 488
Default

hmm, i put dzsbot on a timer, i havent looked at it properly yet, it musta been dropping to bottom, then executing itself again...



thanks for spinlock thingy
b>d>>s is offline  
Closed Thread

Tags
background, continue, dzsbot, runs, utimer

Thread Tools
Display Modes 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

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
force TLS ? NalgeNunc Suggestions 15 01-27-2003 09:15 AM


All times are GMT -5. The time now is 01:17 AM.

Parts of this site powered by vBulletin Mods & Addons from DragonByte Technologies Ltd. (Details)