stop() public static method

Stop dispatching on the default event queue for the specified bridge. MAMA employs a reference count to track multiple calls to Mama.start() and Mama.stop(). The count is incremented every time Mama.start() is called and decremented when Mama.stop() is called. The first Mama.start() call does not unblock until the count reaches zero. This function is thread safe.
public static stop ( Wombat.MamaBridge bridgeImpl ) : void
bridgeImpl Wombat.MamaBridge /// The bridge specific structure. ///
return void
Beispiel #1
0
            public override void onIo(MamaIo io, mamaIoType ioType)
            {
                Socket sock = example_.client;

                byte [] buffer = new byte[1024];
                int     len    = sock.Receive(buffer, 1023, SocketFlags.None);

                buffer[len] = (byte)'\0';

                string text = Encoding.ASCII.GetString(buffer, 0, len);

                if (!example_.quiet)
                {
                    Console.WriteLine("READ: {0}", text);
                }

                // should test for "quit", but Windows' telnet client won't send it
                // no matter if "set mode stream" was used and would send only partial
                // substrings, such as "q", then "uit", "qu", then "it", etc.
                if (text.StartsWith("q"))
                {
                    Console.WriteLine("QUITING");
                    Mama.stop(MamaIoCS.bridge);
                    return;
                }

                sock.Send(buffer, len, SocketFlags.None);
            }
 public void onTimer(MamaTimer mamaTimer, object closure)
 {
     Publish(null);
     if (messageCount_ > 0 && --messageCount_ == 0)
     {
         Mama.stop(bridge);
         return;
     }
 }
 // Timer Callbacks
 public void onTimer(MamaTimer mamaTimer, object closure)
 {
     Publish(null);
     if (messageCount > 0 && --messageCount <= 0)
     {
         publisher.destroy();
         System.Threading.Thread.Sleep(1000);                                    // let queued events process
         Mama.stop(bridge);
     }
 }