public void StartThreadPoolTest() { BaseWorld target = new BaseWorld(); // TODO: 初始化为适当的值 int maxThreadsAllowed = 0; // TODO: 初始化为适当的值 target.StartThreadPool(maxThreadsAllowed); Assert.Inconclusive("无法验证不返回值的方法。"); }
/// <summary> /// /// </summary> /// <param name="baseWorld"></param> public static void AddWorld( BaseWorld world ) { if ( world == null ) throw new Exception( "OneServer.AddWorld(...) - world == null error!" ); s_OnlyLockAddRemove.Enter(); { // 创建新的MessagePump数组,添加数据,交换数组数据,不需要锁定,没有引用时自动会回收数据 BaseWorld[] tempWorld = new BaseWorld[s_WorldArray.Length + 1]; for ( int iIndex = 0; iIndex < s_WorldArray.Length; ++iIndex ) tempWorld[iIndex] = s_WorldArray[iIndex]; tempWorld[s_WorldArray.Length] = world; s_WorldArray = tempWorld; } s_OnlyLockAddRemove.Exit(); // 是否已经初始化过World了 if ( s_bIsInitWorld == true ) { // 创建World运行世界的线程 if ( s_ConfigServer.IsChangeWorldThreadCount == true ) world.StartThreadPool( s_ConfigServer.WorldThreadCount ); else world.StartThreadPool( OneServer.ProcessorCount * 2 + 2 ); // 在开始运行世界之前,初始化一次BaseWorld world.OnInitOnce(); // 启动BaseWorld保存数据的时间片 world.StartSaveTimeSlice(); // 初始化网络客户端在线状态的检查 world.StartCheckAllAliveTime(); } }