egghelp.org community Forum Index
[ egghelp.org home | forum home ]
egghelp.org community
Discussion of eggdrop bots, shell accounts and tcl scripts.
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

modules and multi-threading
Goto page Previous  1, 2
 
Post new topic   Reply to topic    egghelp.org community Forum Index -> Modules & Programming
View previous topic :: View next topic  
Author Message
Kappa007
Voice


Joined: 26 Jul 2005
Posts: 38

PostPosted: Sat Apr 01, 2006 7:08 pm    Post subject: Reply with quote

Actually that's the purpose i'm using it already for.
Using MySQL++ in a separate thread...
Back to top
View user's profile Send private message
heretic^
Voice


Joined: 23 Mar 2004
Posts: 5

PostPosted: Sun Apr 09, 2006 9:17 pm    Post subject: Reply with quote

Yes, i've done this before. I made a thread-safe wrapper for eggdrop's i/o functionality, and yes I did have a valid use for threads as well. It all works great.
_________________
In the midst of life, we are in death
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Kappa007
Voice


Joined: 26 Jul 2005
Posts: 38

PostPosted: Mon Apr 10, 2006 2:54 am    Post subject: Reply with quote

See, i'm not the only one Very Happy

Nevertheless, I think I might change to the "use-tcl-sockets-for-IPC" approach De Kus mentioned.
Just "feels" better than polling some queue once a second.
Back to top
View user's profile Send private message
demond
Revered One


Joined: 12 Jun 2004
Posts: 3073
Location: San Francisco, CA

PostPosted: Mon Apr 10, 2006 3:03 am    Post subject: Reply with quote

so where is your working, fully functional stuff? (addressing both kappa & heretic)

if it's supposed to serve the general public, please provide a download link to it

if it's private, I see no point of discussing it here
_________________
connection, sharing, dcc problems? click <here>
before asking for scripting help, read <this>
use [code] tag when posting logs, code
Back to top
View user's profile Send private message Visit poster's website
De Kus
Revered One


Joined: 15 Dec 2002
Posts: 1361
Location: Germany

PostPosted: Mon Apr 10, 2006 11:36 am    Post subject: Reply with quote

Kappa007 wrote:
I think I might change to the "use-tcl-sockets-for-IPC" approach De Kus mentioned.
Just "feels" better than polling some queue once a second.

actually its polled about once every half second. when I used fileevent with millisecond timestamps I noticed they are always in 500ms steps. But usually it doesnt matter if your bot response in 100ms or 500ms, since the user on IRC will both see due to server queue usually at the same time.

A valid use of thread safe eggdrop would be, if you cannot fork into a child process for some reason (like sharing larger amount of data for fast acccess in both ways). But for that purpose you could still hack into the eggdrop mainloop to exchange data with the child without touching offer parts of the bot.
_________________
De Kus
StarZ|De_Kus, De_Kus or DeKus on IRC
Copyright © 2005-2009 by De Kus - published under The MIT License
Love hurts, love strengthens...
Back to top
View user's profile Send private message MSN Messenger
heretic^
Voice


Joined: 23 Mar 2004
Posts: 5

PostPosted: Fri Apr 14, 2006 4:02 pm    Post subject: Reply with quote

demond wrote:
so where is your working, fully functional stuff? (addressing both kappa & heretic)

if it's supposed to serve the general public, please provide a download link to it

if it's private, I see no point of discussing it here

http://www.scorebots.org

I cant really release the source code, but i'm more than willing to supply help to anyone that needs it.

I basically created a cmodule to run multiple "scorebots" per single eggdrop. The reason why I needed to use threads instead of some "polling" system was to create real time output in relation to the "scorebot". Right now I run a free IRC service to the users of the GameSurge network. Currently we are serving over 500 channels.
_________________
In the midst of life, we are in death
Back to top
View user's profile Send private message Send e-mail Visit poster's website
De Kus
Revered One


Joined: 15 Dec 2002
Posts: 1361
Location: Germany

PostPosted: Fri Apr 14, 2006 5:17 pm    Post subject: Reply with quote

so basicly every single scorebot is single threaded again?! Thats no multithreading like demond wanted it to hear Very Happy. The problems that occur with multithreading is only meaningfull, when there is more than one thread for the same bot/IRC connection.
_________________
De Kus
StarZ|De_Kus, De_Kus or DeKus on IRC
Copyright © 2005-2009 by De Kus - published under The MIT License
Love hurts, love strengthens...
Back to top
View user's profile Send private message MSN Messenger
heretic^
Voice


Joined: 23 Mar 2004
Posts: 5

PostPosted: Fri Apr 14, 2006 7:31 pm    Post subject: Reply with quote

yes, multi-threaded in the fact that if channel #a has ScoreBot-01 and channel #b has ScoreBot-01 and they're both running a scorebot at the same time, then there are 2 threads running the scorebot code.

each thread has to allocate at least 1 UDP socket, and sometimes 1 TCP socket to connect to and interact with the desired gameserver, then it parses the gamelogs updates a few player nodes, and outputs through a thread-safe function
_________________
In the midst of life, we are in death
Back to top
View user's profile Send private message Send e-mail Visit poster's website
demond
Revered One


Joined: 12 Jun 2004
Posts: 3073
Location: San Francisco, CA

PostPosted: Fri Apr 14, 2006 9:44 pm    Post subject: Reply with quote

heretic^ wrote:
demond wrote:
so where is your working, fully functional stuff? (addressing both kappa & heretic)

if it's supposed to serve the general public, please provide a download link to it

if it's private, I see no point of discussing it here

http://www.scorebots.org


nothing to download there, so it's basically irrelevant to this forum's purpose (at least as I understand it - it's not about MT in general and even not about the programming in general, but about eggdrop and eggdrop modules programming - and eggdrop is open-source)
_________________
connection, sharing, dcc problems? click <here>
before asking for scripting help, read <this>
use [code] tag when posting logs, code
Back to top
View user's profile Send private message Visit poster's website
heretic^
Voice


Joined: 23 Mar 2004
Posts: 5

PostPosted: Sat Apr 15, 2006 6:12 am    Post subject: Reply with quote

Kappa007 wrote:
Anyone seen/used any other approach?


demond wrote:
nothing to download there, so it's basically irrelevant to this forum's purpose (at least as I understand it - it's not about MT in general and even not about the programming in general, but about eggdrop and eggdrop modules programming - and eggdrop is open-source)


I'm sorry if you feel that's irrelevant but I was merely responding to Kappa's post, I apologize if I offended you in the process of contributing to this thread. I'm not trying to start a flamewar here or anything I was just merely responding to the author of this thread.
_________________
In the midst of life, we are in death
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Kappa007
Voice


Joined: 26 Jul 2005
Posts: 38

PostPosted: Sat Apr 15, 2006 11:41 am    Post subject: Reply with quote

No hurry, i'll put my stuff under public domain once i got time to cleanup the code...
Back to top
View user's profile Send private message
demond
Revered One


Joined: 12 Jun 2004
Posts: 3073
Location: San Francisco, CA

PostPosted: Sat Apr 15, 2006 4:00 pm    Post subject: Reply with quote

heretic^ wrote:
Kappa007 wrote:
Anyone seen/used any other approach?


demond wrote:
nothing to download there, so it's basically irrelevant to this forum's purpose (at least as I understand it - it's not about MT in general and even not about the programming in general, but about eggdrop and eggdrop modules programming - and eggdrop is open-source)


I'm sorry if you feel that's irrelevant but I was merely responding to Kappa's post, I apologize if I offended you in the process of contributing to this thread. I'm not trying to start a flamewar here or anything I was just merely responding to the author of this thread.


no offense taken, you've done a good job; hopefully you'll share it some day with the community
_________________
connection, sharing, dcc problems? click <here>
before asking for scripting help, read <this>
use [code] tag when posting logs, code
Back to top
View user's profile Send private message Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic    egghelp.org community Forum Index -> Modules & Programming All times are GMT - 4 Hours
Goto page Previous  1, 2
Page 2 of 2

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Forum hosting provided by Reverse.net

Powered by phpBB © 2001, 2005 phpBB Group
subGreen style by ktauber