@Override
        public void run()
        {
            // Synchronise on thread counter
            
            synchronized( AsyncTransmitter.threadCount )
            {
                // If no other threads exist, change receiver
                
                if( AsyncTransmitter.threadCount < 1 )
                {
                    AsyncTransmitter.receiver = AsyncTransmitter.asyncReceiver;
                }
                
                // Increment thread count
                
                AsyncTransmitter.threadCount = 1;
            }
            
            // Set stop flag
            
            synchronized( stop )
            {
                stop = false;
            }
            
            // Enter main loop
                
            Signal signal = null;
            
            boolean active = true;
            
            while( active )
            {
                // Get signal from queue
                
                synchronized( AsyncTransmitter.queue )
                {
                    signal = AsyncTransmitter.queue.poll();
                }
                
                // If no signal was returned, wait on queue
                    
                if( signal == null )
                {
                    try
                    {
                        AsyncTransmitter.queue.wait();
                    }
                    catch( Throwable t ){}
                }
                else
                {
                    // Signal was returned, transmit it
                    
                    try
                    {
                        signal.getReceiver().receive( signal );
                    }
                    catch( Throwable t ){}
                }
                
                // Check stop condition
                
                synchronized( stop )
                {
                    if( stop )
                    {
                        active = false;
                    }
                }
            }
            
            // Synchronise on thread counter
            
            synchronized( AsyncTransmitter.threadCount )
            {
                // Decrement thread count
                
                AsyncTransmitter.threadCount -= 1;
                
                // If no other threads exist, change receiver
                
                if( AsyncTransmitter.threadCount < 1 )
                {
                    AsyncTransmitter.threadCount = 0;
                    AsyncTransmitter.receiver = AsyncTransmitter.syncReceiver;
                }
            }
        }