System.Threading.Thread.Join C# (CSharp) Méthode

Join() public méthode

public Join ( System timeout ) : bool
timeout System
Résultat bool
        public bool Join(System.TimeSpan timeout)
        {
            throw null;
        }

Same methods

Thread::Join ( int millisecondsTimeout ) : bool
Thread::Join ( ) : void

Usage Example

        public void Instance_is_reused_on_same_thread_when_controlled_by_threadsingleton_lifecycle()
        {
            var builder = new ContainerBuilder();

            builder.DefaultControlledBy<ThreadSingletonLifecycle>();
            builder.Register<IFoo, Foo>();
            builder.Register<IBar, Bar>();

            var container = builder.Build();

            var threadData = new ThreadData(container);
            var thread = new Thread(threadData.ResolveFoosWithContainer);

            var threadDataTwo = new ThreadData(container);
            var threadTwo = new Thread(threadDataTwo.ResolveFoosWithContainer);

            thread.Start();
            threadTwo.Start();

            thread.Join();
            threadTwo.Join();

            Assert.IsTrue(ReferenceEquals(threadData.FooOne, threadData.FooTwo));
            Assert.IsFalse(ReferenceEquals(threadData.FooOne, threadDataTwo.FooOne));
        }
All Usage Examples Of System.Threading.Thread::Join