<?xml version="1.0" encoding="UTF-8"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en-gb">
	<link rel="self" type="application/atom+xml" href="https://forum.eggheads.org/app.php/feed/topic/3602" />

	<title>egghelp/eggheads community</title>
	<subtitle>Discussion of eggdrop bots, shell accounts and tcl scripts.</subtitle>
	<link href="https://forum.eggheads.org/index.php" />
	<updated>2003-02-05T11:35:08-04:00</updated>

	<author><name><![CDATA[egghelp/eggheads community]]></name></author>
	<id>https://forum.eggheads.org/app.php/feed/topic/3602</id>

		<entry>
		<author><name><![CDATA[ppslim]]></name></author>
		<updated>2003-02-05T11:35:08-04:00</updated>

		<published>2003-02-05T11:35:08-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=16212#p16212</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=16212#p16212"/>
		<title type="html"><![CDATA[Multithreaded Eggdrop ?]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=16212#p16212"><![CDATA[
There are 2 methods in Tcl.<br><br>One is to use the exec module, which is available on the eggheads.org FTP server.<br><br>Second it is use the normal exec command.<br><br>Tcl's exec command will run applications in the background, however, this is not documented.<br><br>Proof of concept.<br><br>FILE: test1<div class="codebox"><p>Code: </p><pre><code>#!/usr/bin/tclshputs stdout "Program 1 - test 1"after 1000puts stdout "program 1 - test 2"exec /root/test2 &amp;puts stdout "program 1 - test 3"</code></pre></div>FILE: test2<div class="codebox"><p>Code: </p><pre><code>#!/usr/bin/tclshafter 1000puts stdout "Program 2 - test 1"</code></pre></div>If exec was to block, we would expect to see<blockquote class="uncited"><div>Program 1 - test 1<br>Program 1 - test 2<br>Program 2 - test 1<br>Program 1 - test 3</div></blockquote>However, I get<blockquote class="uncited"><div>[rootdev@services root]# ./test1<br>Program 1 - test 1<br>program 1 - test 2<br>program 1 - test 3<br>[rootdev@services root]# Program 2 - test 1</div></blockquote>The mess with the output, is caused by the second program, doing output to the console, after control has been returned to my shell program.<br><br>The exec command should never use quotes, which can cause lot of issues. Any quotes that need to be directly passed to a program, need to be excaped.<br><br>The last character on the line, of a exec command needs to be the &amp;, without any &gt;, &gt;&gt;, &lt;, &lt;&lt; touching (which won't be needed anyway).<br><br>I used this teqnique for repair databases, which would collect about 1MB of data per hour. While not large, repair, sort and optimisation could take a long time.<br><br>Before launching background operations, my bot would timeout and not return for 2 mins for every 5 MBytes. Thus, you can imagine how long the bot was out for if the database was 50MBytes.<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=2">ppslim</a> — Wed Feb 05, 2003 11:35 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[Photon]]></name></author>
		<updated>2003-02-05T10:50:36-04:00</updated>

		<published>2003-02-05T10:50:36-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=16205#p16205</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=16205#p16205"/>
		<title type="html"><![CDATA[Multithreaded Eggdrop ?]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=16205#p16205"><![CDATA[
A minor point, but in my experience tcl exec blocks until the external process quits.<br><br>Under C it is very easy to multithread (i've just done it in a module I'm writing, but not easy to get the output from the second task unless it specifically reads/writes from a file.) However, you can flag completion easily (see fork() execl() and wait() for more details.<br><br>So, if you can code c, I'd recomend a module. If not ... um...<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=1824">Photon</a> — Wed Feb 05, 2003 10:50 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[Anonymous]]></name></author>
		<updated>2003-02-05T09:52:22-04:00</updated>

		<published>2003-02-05T09:52:22-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=16197#p16197</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=16197#p16197"/>
		<title type="html"><![CDATA[Multithreaded Eggdrop ?]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=16197#p16197"><![CDATA[
Fantastic response, thanks.<br><br>Something to get my teeth into again <img class="smilies" src="https://forum.eggheads.org/images/smilies/icon_biggrin.gif" width="15" height="15" alt=":D" title="Very Happy"><br><br>Thanks<br>Si<p>Statistics: Posted by Guest — Wed Feb 05, 2003 9:52 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[ppslim]]></name></author>
		<updated>2003-02-05T09:44:49-04:00</updated>

		<published>2003-02-05T09:44:49-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=16196#p16196</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=16196#p16196"/>
		<title type="html"><![CDATA[Multithreaded Eggdrop ?]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=16196#p16196"><![CDATA[
First off, I aint an expert in this area, so take the comments at face value.<br><br>I don't think C is multi-threaded, only C++.<br><br>That being said, back to juicy part.<br><br>You don't need a multi-threaded bot, to perform blocking tasks. Only a set of utilities to manage input/output from other programs.<br><br>If a script is going to block, then you are bound to have timeouts, and even more so when queries start queuing.<br><br>With a launch and monitor system, you can process queries independantly of the obt, and retreive the output for display.<br><br>IE.<br><br>1:  Query comes in.<br><br>2: Process any inofmration, needed to make the query<br><br>3: Create a random filename, that can be used to store results<br><br>4: Launch/exec second application in the background, giving the random filename, and the PID of the bot.<br><br>5: Script exit.<br><br>The second application, should do it's job, and otuput any data to the file. Once complete, it should signal to eggdrop as such. This can be done with kill signals (not all of them kill the bot, and some are scriptable).<br><br>When eggdrop gets the kill signal. It check to see which files are complete, out of a list of query requests (this method in genral, will allow for multiple queries to operate at the same time).<br><br>It will then process/output the information, then delete the temporary file.<br><br>While this isn't multi-threading, it does do the job just as good.<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=2">ppslim</a> — Wed Feb 05, 2003 9:44 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[Anonymous]]></name></author>
		<updated>2003-02-05T09:32:45-04:00</updated>

		<published>2003-02-05T09:32:45-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=16192#p16192</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=16192#p16192"/>
		<title type="html"><![CDATA[Multithreaded Eggdrop ?]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=16192#p16192"><![CDATA[
The bot I run is a service bot.  What I mean by that is that it is in constant use reporting information from a database.  When a user asks for a long report (we don't actually know how long teh report will be until its run), it can tie up the bot for a while with all other requests for information from the bot being queued up.<br><br>I fully understand the implications of mulithreaded bots and writing to DBs, with locks etc causing probs. But, what if its only reading from a DB, surely it doesn't matter, and can speed up access to the bot tremendously, esp for bots like mine which spend their time spewing out stats/info from a DB built up from cheats/players on a set of game servers for the admins in their IRC channel.<br><br>I would be really kewl if this was implemented as a "type" of function, so that in your TCL you would essentially be saying "this function can run in multithreaded mode as its only reading from a DB", that way you could implement DB write functions in non-multithreaded mode, hence avoiding the need for extra locks etc.<br><br>Hope that makes sense.<br><br>Also, it would be nice to be able to "interupt" a bots output somehow.  Not sure if this can already be done, i've looked and can't see how.<br><br>Cheers<br>Si<p>Statistics: Posted by Guest — Wed Feb 05, 2003 9:32 am</p><hr />
]]></content>
	</entry>
	</feed>
