It is currently March 29th, 2024, 12:16 am
[help] C# and multithreading
-
- Developer
- Posts: 22628
- Joined: April 19th, 2009, 11:02 pm
- Location: Fort Hunt, Virginia, USA
Re: [help] C# and multithreading
I can't really test with that abort still left in the Dispose() function, as that is indeed called when the skin is refreshed (as well as when unloaded), so we still have the issue.
-
- Posts: 64
- Joined: December 24th, 2012, 6:56 pm
Re: [help] C# and multithreading
Fixed. Uploaded.jsmorley wrote:I can't really test with that abort still left in the Dispose() function, as that is indeed called when the skin is refreshed (as well as when unloaded), so we still have the issue.
So, you are saying, Finalize() is called by skin refresh?
-
- Developer
- Posts: 22628
- Joined: April 19th, 2009, 11:02 pm
- Location: Fort Hunt, Virginia, USA
Re: [help] C# and multithreading
Correct.Aragas wrote: Fixed. Uploaded.
So, you are saying, Finalize() is called by skin refresh?
-
- Developer
- Posts: 22628
- Joined: April 19th, 2009, 11:02 pm
- Location: Fort Hunt, Virginia, USA
Re: [help] C# and multithreading
Built your code and am running it. Not sure how to really test other than to let it run and refresh the crap out of it to see if it ever "hangs".
On a side note, FinishAction is never executed with the change you made to that.
On a side note, FinishAction is never executed with the change you made to that.
-
- Posts: 64
- Joined: December 24th, 2012, 6:56 pm
Re: [help] C# and multithreading
I just don't have your skin code, so i can't test FinishAction.jsmorley wrote:Built your code and am running it. Not sure how to really test other than to let it run and refresh the crap out of it to see if it ever "hangs".
On a side note, FinishAction is never executed with the change you made to that.
Compiled and runned. Seems to work.
-
- Developer
- Posts: 22628
- Joined: April 19th, 2009, 11:02 pm
- Location: Fort Hunt, Virginia, USA
Re: [help] C# and multithreading
Let me test further. I may have had an unstable instance of the dll still in memory when I restarted things.Aragas wrote: I just don't have your skin code, so i can't test FinishAction.
Compiled and runned. Seems to work.
-
- Developer
- Posts: 22628
- Joined: April 19th, 2009, 11:02 pm
- Location: Fort Hunt, Virginia, USA
Re: [help] C# and multithreading
So far so good. The issue with FinishAction isn't that it doesn't run at all, it is that it is one update of the measure "behind", so if I have a CheckNet measure with a FinishAction on it that enables a calc measure that tests the value and takes some action, that calc measure is not enabled until after the "second" time the plugin runs.
Some logic flaw in how we are doing FinishAction. It should fire in the skin as soon as the plugin measure completes and some value is returned.
Some logic flaw in how we are doing FinishAction. It should fire in the skin as soon as the plugin measure completes and some value is returned.
-
- Posts: 64
- Joined: December 24th, 2012, 6:56 pm
Re: [help] C# and multithreading
Hm. Strange. Have done some fixes, try the latest commit, maybe will work.jsmorley wrote:So far so good. The issue with FinishAction isn't that it doesn't run at all, it is that it is one update of the measure "behind", so if I have a CheckNet measure with a FinishAction on it that enables a calc measure that tests the value and takes some action, that calc measure is not enabled until after the "second" time the plugin runs.
Some logic flaw in how we are doing FinishAction. It should fire in the skin as soon as the plugin measure completes and some value is returned.
UPD:
Can you tell me what you put in FinishAction in your skin? Maybe it's a problem with letters register.
-
- Developer
- Posts: 22628
- Joined: April 19th, 2009, 11:02 pm
- Location: Fort Hunt, Virginia, USA
Re: [help] C# and multithreading
It gets worse..
If you have a skin with two CheckNet plugin measures in it, one doing "network" and one "doing" internet, the second one is just never executed at all.
If you try this skin:
It won't work correctly at all. Leaving aside the fact that the FinishAction is one measure update behind for the moment, we can come back to that, what happens is that the [MeasureInternet] measure never executes (at least it never receives any value from the plugin).
If I have only one CheckNet measure, either kind, it works fine.
If I "disabled" the second one, and have a FinishAction on the first one "enable" the second one:
Then it works fine. You just can't have two copies of CheckNet both executed at the same time.
If you have a skin with two CheckNet plugin measures in it, one doing "network" and one "doing" internet, the second one is just never executed at all.
If you try this skin:
Code: Select all
[Rainmeter]
Update=1000
AccurateText=1
DynamicWindowSize=1
[Variables]
Green=139,235,136,255
Red=209,104,96,255
[MeasureNetwork]
Measure=Plugin
Plugin=CheckNet
ConnectionType=Network
UpdateRate=5
FinishAction=[!EnableMeasure MeasureNetworkCheck][!UpdateMeasure MeasureNetworkCheck]
[MeasureNetworkCheck]
Measure=Calc
Formula=MeasureNetwork
IfAboveValue=0
IfAboveAction=[!SetOption MeterNetwork SolidColor #Green#][!UpdateMeter *][!Redraw]
IfBelowValue=0
IfBelowAction=[!SetOption MeterNetwork SolidColor #Red#][!UpdateMeter *][!Redraw]
UpdateDivider=-1
Disabled=1
[MeasureInternet]
Measure=Plugin
Plugin=CheckNet
ConnectionType=Internet
UpdateRate=20
FinishAction=[!EnableMeasure MeasureInternetCheck][!UpdateMeasure MeasureInternetCheck]
[MeasureInternetCheck]
Measure=Calc
Formula=MeasureInternet
IfAboveValue=0
IfAboveAction=[!SetOption MeterInternet SolidColor #Green#][!UpdateMeter *][!Redraw]
IfBelowValue=0
IfBelowAction=[!SetOption MeterInternet SolidColor #Red#][!UpdateMeter *][!Redraw]
UpdateDivider=-1
Disabled=1
[MeterNetwork]
Meter=Image
W=20
H=20
SolidColor=150,150,150,255
[MeterInternet]
Meter=Image
X=3R
W=20
H=20
SolidColor=150,150,150,255
If I have only one CheckNet measure, either kind, it works fine.
If I "disabled" the second one, and have a FinishAction on the first one "enable" the second one:
Code: Select all
[Rainmeter]
Update=1000
AccurateText=1
DynamicWindowSize=1
[Variables]
Green=139,235,136,255
Red=209,104,96,255
[MeasureNetwork]
Measure=Plugin
Plugin=CheckNet
ConnectionType=Network
UpdateRate=5
FinishAction=[!EnableMeasure MeasureNetworkCheck][!UpdateMeasure MeasureNetworkCheck]
[MeasureNetworkCheck]
Measure=Calc
Formula=MeasureNetwork
IfAboveValue=0
IfAboveAction=[!SetOption MeterNetwork SolidColor #Green#][!UpdateMeter *][!EnableMeasure MeasureInternet][!Redraw]
IfBelowValue=0
IfBelowAction=[!SetOption MeterNetwork SolidColor #Red#][!UpdateMeter *][!Redraw]
UpdateDivider=-1
Disabled=1
[MeasureInternet]
Measure=Plugin
Plugin=CheckNet
ConnectionType=Internet
UpdateRate=20
Disabled=1
FinishAction=[!EnableMeasure MeasureInternetCheck][!UpdateMeasure MeasureInternetCheck]
[MeasureInternetCheck]
Measure=Calc
Formula=MeasureInternet
IfAboveValue=0
IfAboveAction=[!SetOption MeterInternet SolidColor #Green#][!UpdateMeter *][!Redraw]
IfBelowValue=0
IfBelowAction=[!SetOption MeterInternet SolidColor #Red#][!UpdateMeter *][!Redraw]
UpdateDivider=-1
Disabled=1
[MeterNetwork]
Meter=Image
W=20
H=20
SolidColor=150,150,150,255
[MeterInternet]
Meter=Image
X=3R
W=20
H=20
SolidColor=150,150,150,255
-
- Posts: 64
- Joined: December 24th, 2012, 6:56 pm
Re: [help] C# and multithreading
I think i can easy fix that. My method with switch can handle with it. I'll make it tomorrow if you don't mind.