public static void Initialize(int maxSlots, int overlimitSlots = 0) { if (maxSlots < 1) maxSlots = 1; else if (maxSlots > MAX_SLOTS) maxSlots = MAX_SLOTS; if (overlimitSlots < 0) overlimitSlots = 0; else if (overlimitSlots > maxSlots) overlimitSlots = maxSlots; ProgramLog.Log("{2} {0}+{1} {3}.", maxSlots, overlimitSlots, Language.Languages.InitializingSlotManagerFor, Language.Languages.Players); lock (syncRoot) { freeSlots.Clear (); for (int i = maxSlots - 1; i >= 0; i--) { isPrivileged[i] = false; freeSlots.Push (i); } privFreeSlots.Clear (); for (int i = MAX_SLOTS; i >= maxSlots; i--) { isPrivileged[i] = true; privFreeSlots.Push (i); } for (int q = 0; q < 4; q++) queues[q] = new Queue (); privSlotsInUse = 0; SlotManager.maxSlots = maxSlots; SlotManager.overlimitSlots = overlimitSlots; } }
public ServerSlot() { writeQueue = new Queue<byte[]> (); writeSignal = new AutoResetEvent (false); state = SlotState.VACANT; }