Ejemplo n.º 1
0
        public EventWaitHandle(bool initialState, EventResetMode mode)
        {
            bool created;
            bool manual = IsManualReset(mode);

            semaphore = CreateSemaphore(manual, initialState, null, out created);
        }
Ejemplo n.º 2
0
        /*
		public EventWaitHandle (bool initialState, EventResetMode mode,string name)
		{
			bool created;
			bool manual = IsManualReset (mode);
            semaphore = CreateSemaphore(manual, initialState, name, out created);
		}
		
		public EventWaitHandle (bool initialState, EventResetMode mode, string name, out bool createdNew)
		{
			bool manual = IsManualReset (mode);
            semaphore = CreateSemaphore(manual, initialState, name, out createdNew);
		}
        */

        private Java.Util.Concurrent.Semaphore CreateSemaphore(bool manual, bool initialState, string name, out bool createdNew)
        {
            if (!manual) throw new NotImplementedException("System.Threading.EventResetMode.AutoReset is not implemented");

            var result = new Java.Util.Concurrent.Semaphore(1);
            if (initialState) result.Acquire();

            createdNew = true;

            return result;
        }
Ejemplo n.º 3
0
        /*
         *      public EventWaitHandle (bool initialState, EventResetMode mode,string name)
         *      {
         *              bool created;
         *              bool manual = IsManualReset (mode);
         *  semaphore = CreateSemaphore(manual, initialState, name, out created);
         *      }
         *
         *      public EventWaitHandle (bool initialState, EventResetMode mode, string name, out bool createdNew)
         *      {
         *              bool manual = IsManualReset (mode);
         *  semaphore = CreateSemaphore(manual, initialState, name, out createdNew);
         *      }
         */

        private Java.Util.Concurrent.Semaphore CreateSemaphore(bool manual, bool initialState, string name, out bool createdNew)
        {
            if (!manual)
            {
                throw new NotImplementedException("System.Threading.EventResetMode.AutoReset is not implemented");
            }

            var result = new Java.Util.Concurrent.Semaphore(1);

            if (initialState)
            {
                result.Acquire();
            }

            createdNew = true;

            return(result);
        }
Ejemplo n.º 4
0
		public EventWaitHandle (bool initialState, EventResetMode mode)
		{
			bool created;
			bool manual = IsManualReset (mode);
            semaphore = CreateSemaphore(manual, initialState, null, out created);
		}