Forum Discussion
How to Create a empty pool using C#?
I wrote following code to create a LBPool but it only works if i have at least one member(s). My application need to create a empty pool and add it to a VirtualServer.
// Create member
var members = nodes.Select(t => new CommonIPPortDefinition
{
address = t.Address,
port = t.Port
}).ToArray();
var newMembers = new CommonIPPortDefinition[][] { members };
// Create pool with algorithms
m_interfaces.LocalLBPool.create(new string[] { name }, new LocalLBLBMethod[] { method }, newMembers);
- ruhhanaNimbostratus
Steps to Create Thread Pooling in C#.NET
static void ProcessWithThreadMethod()
{
for (int i = 0; i <= 10; i++)
{
Thread obj = new Thread(Process);
obj.Start();
}
}
static void ProcessWithThreadPoolMethod()
{
for (int i = 0; i <= 10; i++)
{
ThreadPool.QueueUserWorkItem(new WaitCallback(Process));
}
}
using System;
using System.Threading;
using System.Diagnostics;
namespace ThreadPooling
{
class Program
{
static void Main(string[] args)
{
Stopwatch mywatch = new Stopwatch();
Console.WriteLine("Thread Pool Execution");
mywatch.Start();
ProcessWithThreadPoolMethod();
mywatch.Stop();
Console.WriteLine("Time consumed by ProcessWithThreadPoolMethod is : " + mywatch.ElapsedTicks.ToString());
mywatch.Reset();
Console.WriteLine("Thread Execution");
mywatch.Start();
ProcessWithThreadMethod();
mywatch.Stop();
Recent Discussions
Related Content
* Getting Started on DevCentral
* Community Guidelines
* Community Terms of Use / EULA
* Community Ranking Explained
* Community Resources
* Contact the DevCentral Team
* Update MFA on account.f5.com