<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Recent changes to ASThread</title><link>https://sourceforge.net/p/tsar/wiki/ASThread/</link><description>Recent changes to ASThread</description><atom:link href="https://sourceforge.net/p/tsar/wiki/ASThread/feed" rel="self"/><language>en</language><lastBuildDate>Fri, 31 Aug 2012 10:45:28 -0000</lastBuildDate><atom:link href="https://sourceforge.net/p/tsar/wiki/ASThread/feed" rel="self" type="application/rss+xml"/><item><title>WikiPage ASThread modified by rwaury</title><link>https://sourceforge.net/p/tsar/wiki/ASThread/</link><description>&lt;pre&gt;--- v7
+++ v8
@@ -23,13 +23,13 @@
 
 At Thread Exit Handlers:
 
-&lt;b&gt;atexit(Func,UserPtr)&lt;/b&gt;
+&lt;b&gt;static bool atexit(atexitThreadFn_t Func, void \*UserPtr)&lt;/b&gt;
 
 Registers a global handler. Multiple calls to atexit with the same {Func,UserPtr} results in only on registration (the same number of unatexit() calls would then be required).
 
 atexit() can be used to cleanup associated TLS resources; where UserPtr is the TLSKey_t.
 
-&lt;b&gt;unatexit(Func,UserPtr)&lt;/b&gt;
+&lt;b&gt;static void unatexit(atexitThreadFn_t Func, void \*UserPtr)&lt;/b&gt;
 
 Unregisters a handler for a particular {Func,UserPtr} pair.
 
&lt;/pre&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">rwaury</dc:creator><pubDate>Fri, 31 Aug 2012 10:45:28 -0000</pubDate><guid>https://sourceforge.net7f7ba12ec8a21e30138314dfea30e09aa165bcaa</guid></item><item><title>WikiPage ASThread modified by rwaury</title><link>https://sourceforge.net/p/tsar/wiki/ASThread/</link><description>&lt;pre&gt;--- v6
+++ v7
@@ -19,11 +19,51 @@
 
 ###### ASThread ######
 
+&lt;b&gt;Methods:&lt;/b&gt;
+
+At Thread Exit Handlers:
+
+&lt;b&gt;atexit(Func,UserPtr)&lt;/b&gt;
+
+Registers a global handler. Multiple calls to atexit with the same {Func,UserPtr} results in only on registration (the same number of unatexit() calls would then be required).
+
+atexit() can be used to cleanup associated TLS resources; where UserPtr is the TLSKey_t.
+
+&lt;b&gt;unatexit(Func,UserPtr)&lt;/b&gt;
+
+Unregisters a handler for a particular {Func,UserPtr} pair.
+
+Note: unatexit() is optional as no resources are associated with a registration.
+    
+&lt;b&gt;Virtual Methods:&lt;/b&gt;
+
+&lt;b&gt;const char* GetClassName()&lt;/b&gt;
+
+Example Handler:
+
+~~~~~
+void MYAtExit(void*)
+{
+    MYThread *MyThread;
+    ASThread *Active = GetActiveThread();
+    MyThread = dynamic_cast&lt;MYThread*&gt;(Active);
+    if (MyThread) MyThread-&gt;Bye();
+    else
+    {
+        printf("End of Non-MYThread: %s\n", MyThread-&gt;GetClassName());
+    }
+    return;
+}
+~~~~~
+
 * * *
 
 ## Functions ##
 
 ###### ASThread\* GetActiveThread() ######
+
+A thread handler can get access to the current thread exiting by calling GetActiveThread().
+The "type" of thread returned by GetActiveThread() can be determined by GetClassName() or by RTTI dynamic_cast() operator.
 
 ###### bool IsActiveThread(ASThread \*Thread) ######
 
&lt;/pre&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">rwaury</dc:creator><pubDate>Fri, 31 Aug 2012 10:43:47 -0000</pubDate><guid>https://sourceforge.net5a0fac59b7024a4e897a5656c49d2f5c2e819b1e</guid></item><item><title>WikiPage ASThread modified by rwaury</title><link>https://sourceforge.net/p/tsar/wiki/ASThread/</link><description>&lt;pre&gt;--- v5
+++ v6
@@ -32,3 +32,157 @@
 * * *
 
 ## Usage ##
+
+Example 1:
+
+~~~~~
+#include &lt;stdio.h&gt;
+#include &lt;ASThread.h&gt;
+
+class ZooThread : public ASThread
+        {
+        private:
+                char *Animal;
+                char *Speak;
+        protected:
+                int ThreadMain();
+        public:
+                ZooThread(char *animal, char *speak)
+                        {
+                        Animal = animal;
+                        Speak = speak;
+                        return;
+                        }
+        };
+
+int ZooThread::ThreadMain()
+        {
+        for (int i=0; i &lt; 5; i++)
+                {
+                printf("The %s goes %s\n",Animal,Speak);
+                Sleep(1000);
+                }
+        return 0;
+        }
+
+main(int argc, char *argv[]) 
+	{
+        ZooThread Cows("Cow","Moo");
+        ZooThread Dogs("Dog","Ruff");
+        Cows.Start();
+        Dogs.Start();
+        Cows.Wait();
+        Dogs.Wait();
+        printf("All Done\n");
+	return 0;
+	}
+~~~~~
+
+* * *
+
+Example 2:
+
+~~~~~
+#include &lt;stdio.h&gt;
+#include &lt;ASThread.h&gt;
+
+#ifndef _WIN32
+        #include &lt;unistd.h&gt;
+        #define Sleep(x) sleep(x/1000)
+#endif
+
+class AnimalThread: public ASThread, public MessageQueue
+        {
+        private:
+                char *Animal;
+                char *Speak;
+        protected:
+                int ThreadMain();
+        public:
+                AnimalThread(char *animal, char *speak)
+                        {
+                        Animal = animal;
+                        Speak = speak;
+                        return;
+                        }
+                char *GetName() {return Animal;}
+        };
+
+class ZooThread : public ASThread
+        {
+        private:
+                int SleepTime;
+                AnimalThread *WatchAnimal;
+        protected:
+                int ThreadMain();
+        public:
+                ZooThread(AnimalThread &amp;watchAnimal, int sleepTime)
+                        {
+                        WatchAnimal = &amp;watchAnimal;
+                        SleepTime = sleepTime;
+                        return;
+                        }
+        };
+
+int AnimalThread::ThreadMain()
+        {
+        int *SpeakMessage = (int *)Receive();
+        while (SpeakMessage &amp;&amp; *SpeakMessage == 1)
+                {
+                printf("The %s goes %s\n",Animal,Speak);
+                delete SpeakMessage;
+                SpeakMessage = (int *)Receive();
+                }
+        printf("The %s says bye...\n",Animal);
+        return 0;
+        }
+
+int ZooThread::ThreadMain()
+        {
+        int *SpeakMessage;      
+        for (int i=0; i &lt; 5; i++)
+                {
+                SpeakMessage = new int;
+                if (SpeakMessage)
+                        {
+                        *SpeakMessage = 1;
+                        printf("Sending to %s\n",WatchAnimal-&gt;GetName());
+                        WatchAnimal-&gt;Send(SpeakMessage);
+                        }
+                Sleep(SleepTime);
+                }
+        SpeakMessage = new int;
+        if (SpeakMessage)
+                {
+                *SpeakMessage = 0;
+                WatchAnimal-&gt;Send(SpeakMessage);
+                }
+        return 0;
+        }
+
+main(int argc, char *argv[]) 
+	{
+        AnimalThread Cow("Cow","Moo");
+        AnimalThread Dog("Dog","Ruff");
+        ZooThread CowZoo(Cow,1000);
+        ZooThread DogZoo(Dog,2000);
+             
+        printf("Starting Cow\n");
+        Cow.Start();
+
+        printf("Starting Dog\n");
+        Dog.Start();
+
+        printf("Starting CowZoo\n");
+        CowZoo.Start();
+
+        printf("Starting DogZoo\n");
+        DogZoo.Start();
+
+        Cow.Wait();
+        Dog.Wait();
+
+        printf("All Done\n");
+	return 0;
+	}
+~~~~~
&lt;/pre&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">rwaury</dc:creator><pubDate>Fri, 31 Aug 2012 10:36:02 -0000</pubDate><guid>https://sourceforge.net0d119185ba9b1e9c3aa8b9b5b97bc348a6778a12</guid></item><item><title>WikiPage ASThread modified by rwaury</title><link>https://sourceforge.net/p/tsar/wiki/ASThread/</link><description>&lt;pre&gt;--- v4
+++ v5
@@ -1,3 +1,5 @@
+Thread / Message Queue Classes
+
 * * *
 
 ## Files ##
@@ -9,10 +11,24 @@
 
 ## Classes ##
 
+###### Semaphore ######
+
+###### Mutex ######
+
+###### MessageQueue ######
+
+###### ASThread ######
+
 * * *
 
 ## Functions ##
 
+###### ASThread\* GetActiveThread() ######
+
+###### bool IsActiveThread(ASThread \*Thread) ######
+
+###### ASThreadID_t GetThreadID() ######
+
 * * *
 
 ## Usage ##
&lt;/pre&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">rwaury</dc:creator><pubDate>Fri, 31 Aug 2012 10:34:00 -0000</pubDate><guid>https://sourceforge.net5360c1b7aab8010f8a493b320698c2a3047efde0</guid></item><item><title>WikiPage ASThread modified by rwaury</title><link>https://sourceforge.net/p/tsar/wiki/ASThread/</link><description>&lt;pre&gt;--- v3
+++ v4
@@ -1,10 +1,18 @@
+* * *
+
 ## Files ##
 
 ASThread.cpp
 ASThread.h
 
+* * *
+
 ## Classes ##
+
+* * *
 
 ## Functions ##
 
+* * *
+
 ## Usage ##
&lt;/pre&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">rwaury</dc:creator><pubDate>Thu, 30 Aug 2012 12:57:47 -0000</pubDate><guid>https://sourceforge.nete5ef5bf76ca26940307ce822fe907fe95dbdd5d3</guid></item><item><title>WikiPage ASThread modified by rwaury</title><link>https://sourceforge.net/p/tsar/wiki/ASThread/</link><description>&lt;pre&gt;--- v2
+++ v3
@@ -1,4 +1,7 @@
 ## Files ##
+
+ASThread.cpp
+ASThread.h
 
 ## Classes ##
 
&lt;/pre&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">rwaury</dc:creator><pubDate>Thu, 30 Aug 2012 12:13:01 -0000</pubDate><guid>https://sourceforge.net28b354258246544493cb3dbfb4caf37815c3281f</guid></item><item><title>WikiPage ASThread modified by rwaury</title><link>https://sourceforge.net/p/tsar/wiki/ASThread/</link><description>&lt;pre&gt;--- v1
+++ v2
@@ -0,0 +1,7 @@
+## Files ##
+
+## Classes ##
+
+## Functions ##
+
+## Usage ##
&lt;/pre&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">rwaury</dc:creator><pubDate>Wed, 29 Aug 2012 09:07:45 -0000</pubDate><guid>https://sourceforge.net12bdaa115847a8fea4e29252e730b622341e276e</guid></item><item><title>WikiPage ASThread modified by rwaury</title><link>https://sourceforge.net/p/tsar/wiki/ASThread/</link><description/><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">rwaury</dc:creator><pubDate>Wed, 29 Aug 2012 08:29:00 -0000</pubDate><guid>https://sourceforge.netd1748dd15b87893b5d8dfdc9385f875f773389f0</guid></item></channel></rss>