Skip to content

Commit

Permalink
v1.1.2
Browse files Browse the repository at this point in the history
- add ThreadInterrupted exception handling
- fix to prevent "Segmentation fault" on .NET linux-arm64
  • Loading branch information
genemars committed Mar 5, 2023
1 parent 76ecd24 commit 0e9b633
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 40 deletions.
24 changes: 0 additions & 24 deletions LICENSE
Original file line number Diff line number Diff line change
Expand Up @@ -175,27 +175,3 @@

END OF TERMS AND CONDITIONS

APPENDIX: How to apply the Apache License to your work.

To apply the Apache License to your work, attach the following
boilerplate notice, with the fields enclosed by brackets "[]"
replaced with your own identifying information. (Don't include
the brackets!) The text should be enclosed in the appropriate
comment syntax for the file format. We also recommend that a
file or class name and description of purpose be included on the
same "printed page" as the copyright notice for easier
identification within third-party archives.

Copyright (2012-2023) G-Labs (https://github.com/genielabs)

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
2 changes: 2 additions & 0 deletions XTenLib/XTenLib.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@
<RuntimeIdentifiers>win8-arm;linux-arm;win10-x64;osx.10.11-x64;linux-x64</RuntimeIdentifiers>
<OutputType>Library</OutputType>
<TargetFrameworks>net472;net6.0;netstandard2.0</TargetFrameworks>
<AssemblyVersion>1.1.1.0</AssemblyVersion>
<FileVersion>1.1.1.0</FileVersion>
</PropertyGroup>

<ItemGroup>
Expand Down
44 changes: 29 additions & 15 deletions XTenLib/XTenManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,7 @@ limitations under the License.
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Text;
using System.Threading;
using System.Threading.Tasks;

using NLog;
using XTenLib.Drivers;
Expand Down Expand Up @@ -225,8 +223,15 @@ public void Disconnect()
{
if (connectionWatcher != null)
{
if (!connectionWatcher.Join(5000))
connectionWatcher.Interrupt();
try
{
Thread.Sleep(2000);
}
catch
{
// ignored
}
connectionWatcher.Interrupt();
connectionWatcher = null;
}
disconnectRequested = false;
Expand Down Expand Up @@ -848,8 +853,15 @@ private void Close()
// Stop the Reader task
if (reader != null)
{
if (!reader.Join(5000))
reader.Interrupt();
try
{
Thread.Sleep(2000);
}
catch
{
// ignored
}
reader.Interrupt();
reader = null;
}
OnConnectionStatusChanged(new ConnectionStatusChangedEventArgs(false));
Expand Down Expand Up @@ -1188,14 +1200,7 @@ private void ConnectionWatcherTask()
Thread.Sleep(3000);
if (!disconnectRequested)
{
try
{
Open();
}
catch (Exception e)
{
logger.Error(e);
}
Open();
}
}
catch (Exception e)
Expand All @@ -1204,7 +1209,16 @@ private void ConnectionWatcherTask()
}
}
if (!disconnectRequested)
Thread.Sleep(1000);
{
try
{
Thread.Sleep(1000);
}
catch
{
// ignored
}
}
}
}

Expand Down
2 changes: 1 addition & 1 deletion XTenLib/nuget_pack.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ if (-not ([string]::IsNullOrEmpty($versionStr))) {

$content | Out-File $root\$project\$project.csproj

& dotnet pack $root\$project -o .
& dotnet pack -c release $root\$project -o .
}
else {
Write-Host "Version string is empty, possibly dry run or APPVEYOR_REPO_TAG_NAME environment variable is not set"
Expand Down

0 comments on commit 0e9b633

Please sign in to comment.