Ejemplo n.º 1
0
        public void Free()
        {
            lock (globalLock) {
                if (--poolUsers > 0)
                {
                    return;
                }

                lock (workItems) {
                    stopped = true;
                    threadDone.Set();
                    workItems.Clear();
                    foreach (Thread t in runningThreads)
#if !TARGET_JVM
                    { t.Abort(); }
#else
                    { t.Interrupt(); }
#endif
                    runningThreads.Clear();
                }
                if (this == sharedPool)
                {
                    sharedPool = null;
                }
            }
        }
Ejemplo n.º 2
0
        public void StartListening(object data)
        {
#if TARGET_JVM
            stopped = false;
#endif
            listener = new TcpListener(bindAddress, port);
            if (server_thread == null)
            {
                threadPool = RemotingThreadPool.GetSharedPool();
                listener.Start();

                if (port == 0)
                {
                    port = ((IPEndPoint)listener.LocalEndpoint).Port;
                }

                string[] uris = new String [1];
                uris     = new String [1];
                uris [0] = GetChannelUri();
                channel_data.ChannelUris = uris;

                server_thread = new Thread(new ThreadStart(WaitForConnections));
                server_thread.IsBackground = true;
                server_thread.Start();
            }
        }
Ejemplo n.º 3
0
		public static RemotingThreadPool GetSharedPool ()
		{
			lock (globalLock) {
				if (sharedPool == null)
					sharedPool = new RemotingThreadPool ();
				sharedPool.poolUsers++;
			}
			return sharedPool;
		}
Ejemplo n.º 4
0
 public static RemotingThreadPool GetSharedPool()
 {
     lock (globalLock) {
         if (sharedPool == null)
         {
             sharedPool = new RemotingThreadPool();
         }
         sharedPool.poolUsers++;
     }
     return(sharedPool);
 }
Ejemplo n.º 5
0
		public void Free ()
		{
			lock (globalLock) {
				if (--poolUsers > 0)
					return;
				
				lock (workItems) {
					stopped = true;
					threadDone.Set ();
					workItems.Clear ();
					foreach (Thread t in runningThreads)
#if !TARGET_JVM
						t.Abort ();
#else
						t.Interrupt();
#endif
					runningThreads.Clear ();
				}
				if (this == sharedPool)
					sharedPool = null;
			}
		}