Пример #1
0
        public async Task ThreadTestAsync()
        {
            if (!TestConfig.Instance.GetRunIdemixMTTest())
            {
                return;
            }

            // Select attribute names and generate a Idemix Setup
            string[]    attributeNames = { "Attr1", "Attr2", "Attr3", "Attr4", "Attr5" };
            IdemixSetup setup          = new IdemixSetup(attributeNames);

            // One single task
            IdemixTask taskS = new IdemixTask(setup);

            Assert.IsTrue(await taskS.Call().ConfigureAwait(false));

            // i tasks running at the same time in parallel in different thread pools.
            List <Task> results = new List <Task>();

            for (int i = TASKS; i > 0; i--)
            {
                IdemixTask taskM = new IdemixTask(setup);
                results.Add(Task.Run(async() => { Assert.IsTrue(await taskM.Call().ConfigureAwait(false)); }));
            }

            await Task.WhenAll(results);
        }
Пример #2
0
 public IdemixTask(IdemixSetup idemixSetup)
 {
     setup      = idemixSetup;
     iterations = ITERATIONS;
 }