internal virtual TaskThread CreateThread(string name, Task[] tasks) { lock (this) { TaskThread thread = new TaskThread(NextName(name), tasks); Threads.Add(thread); thread.Start(); return(thread); } }
public void Start() { taskThread = new TaskThread(); taskThread.Start(); statusThread = new StatusCheckThread(); statusThread.Start(); sMSSendter = new PinjamSMSSendter(); sMSSendter.Start(); }
/// <summary> /// Starts an execution thread, adding it to the pool. /// </summary> private static void SpawnTaskThread() { lock (_threadsLock) { if (_threads.Count < TaskMaxThreads) { TaskThread newThread = new TaskThread(); _threads.Add(newThread); newThread.Start(); _stats.SpawnedThreads.Increment(); } } }
protected override void OnStart() { _mainThread.Start(); _sendThread.Start(); _receThread.Start(); IsRunning = true; Logger.Trace("game server start successful"); foreach (RoyNetModule module in _modules) { module.Startup(); } }
public static int startNewThread(int memory) { if (SystemInfo.processorCount > activeThreads.Count) { TaskThread newThread = new TaskThread(currentID, memory); newThread.thread.IsBackground = true; newThread.Start(); activeThreads.Add(currentID, newThread); currentID++; return(currentID - 1); } return(-1); }
/// <summary> /// Starts the new thread of with given memory amount. /// </summary> /// <returns>The new thread id.</returns> /// <param name="memory">Memory.</param> public static int startNewThread(int memory) { TaskThread newThread = new TaskThread(currentThreadID, memory); newThread.thread.IsBackground = true; newThread.Start(); activeThreads.Add(currentThreadID, newThread); currentThreadID += 1; return(currentThreadID - 1); return(-1); }
//private void BeginWaitForGameServer() //{ // _listener.BeginAcceptSocket((p) => // { // var socket = _listener.EndAcceptSocket(p); // var address = socket.RemoteEndPoint as IPEndPoint; // if (socket.AddressFamily == AddressFamily.InterNetwork && address != null && // AllowedIPs.Any(ip => ip == address.Address.ToString())) // { // _socket = socket; // _thread = new TaskThread(Name, OnReceived); // _thread.Start(); // } // else // { // BeginWaitForGameServer(); // } // }, null); //} public void StartListening() { _listener.Start(); _thread.Start(); }