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.
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.
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.
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.
so basicly every single scorebot is single threaded again?! Thats no multithreading like demond wanted it to hear . The problems that occur with multithreading is only meaningfull, when there is more than one thread for the same bot/IRC connection.
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
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
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.
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