I have made a fix for https://forum.team-mediaportal.com/...-occured-while-setting-channel-states.124482/ and https://forum.team-mediaportal.com/...-occured-while-setting-channel-states.124083/.
The exception concourse on Thread abort:
best regards SiggiK
The exception concourse on Thread abort:
Code:
private void AbortChannelStates()
{
lock (_threadlock)
{
if (_setChannelStatesThread != null && _setChannelStatesThread.IsAlive)
{
_setChannelStatesThread.Abort();
}
}
}
public void SetChannelStates(IDictionary<int, ITvCardHandler> cards, ICollection<Channel> channels,
IController tvController)
{
if (channels == null)
{
return;
}
AbortChannelStates();
//call the real work as a thread in order to avoid slower channel changes.
// find all users
ICollection<IUser> allUsers = GetActiveUsers(cards);
ThreadStart starter = () => DoSetChannelStates(cards, channels, allUsers, tvController);
lock (_threadlock)
{
_setChannelStatesThread = new Thread(starter)
{
Name = "Channel state thread",
IsBackground = true,
Priority = ThreadPriority.Lowest
};
_setChannelStatesThread.Start();
}
}
}
best regards SiggiK
Attachments
Last edited by a moderator: