See my fork.
I wrote it with my experience with Rainmeter and multithreading. I think it is very good and so it must be in samples. I have renamed values, it looks now like a sample.
What i want say: I think jsmorley is right, maybe there is a way to make just ReturnVaruable. I will see what i can do.
I want to know every your note about this code
And i think it can't be broken with interaction in Rainmeter. (haha)
Firstblood:
*Counter don't work. Thread is created by every update or something like that.
Fixed. Used ReturnValue. But keeped separated options. In progress.
It is currently April 19th, 2024, 6:02 pm
[help] C# and multithreading
-
- Posts: 64
- Joined: December 24th, 2012, 6:56 pm
-
- Developer
- Posts: 22629
- Joined: April 19th, 2009, 11:02 pm
- Location: Fort Hunt, Virginia, USA
Re: [help] C# and multithreading
On looking at things and talking a bit to poiru, I don't think we want to create the threads in Reload(). That is going to cause issues with how the actual measure in the skin is updated with the current value unless DynamicVariables is always used on the measure.
I need to take a break from this for a while. I have a sense that what your code is doing is more than what is needed, but to be honest I'm having a hard time following it. I get so irritated with the numerous different naming conventions for functions and variables, and the way that the term "cancel" is used in 20 different places with no naming that makes it clear what they are or what they do, that I kinda give up.
I have no idea why we would use such a mess of "_variableName", "VariableName" "variablename", "variableName", and exactly what is a "Ruly"?
I need to take a break from this for a while. I have a sense that what your code is doing is more than what is needed, but to be honest I'm having a hard time following it. I get so irritated with the numerous different naming conventions for functions and variables, and the way that the term "cancel" is used in 20 different places with no naming that makes it clear what they are or what they do, that I kinda give up.
I have no idea why we would use such a mess of "_variableName", "VariableName" "variablename", "variableName", and exactly what is a "Ruly"?
-
- Posts: 64
- Joined: December 24th, 2012, 6:56 pm
Re: [help] C# and multithreading
Yea, i understand that. My code is always hard to readjsmorley wrote:On looking at things and talking a bit to poiru, I don't think we want to create the threads in Reload(). That is going to cause issues with how the actual measure in the skin is updated with the current value unless DynamicVariables is always used on the measure.
I need to take a break from this for a while. I have a sense that what your code is doing is more than what is needed, but to be honest I'm having a hard time following it. I get so irritated with the numerous different naming conventions for functions and variables, and the way that the term "cancel" is used in 20 different places with no naming that makes it clear what they are or what they do, that I kinda give up. I have no idea why we would use such a mess of "_variableName", "VariableName" "variablename", and exactly what is a "Ruly"?
Ruly is our alternative for Thread.Abord(); You wrote it caused a problem, so we fixed it.
Hm. We can then just see if DynamicVariables is used. If not, hen create a Thread in Update().
cancel is a part from Ruly to safely close Thread.
-
- Developer
- Posts: 22629
- Joined: April 19th, 2009, 11:02 pm
- Location: Fort Hunt, Virginia, USA
Re: [help] C# and multithreading
Why the term "Ruly"? Did you just open a dictionary to a random page and point at a word?
-
- Posts: 64
- Joined: December 24th, 2012, 6:56 pm
Re: [help] C# and multithreading
It's a standart:
_variableName is for private variables
VariableName for public
variablename...must be a typo
_variableName is for private variables
VariableName for public
variablename...must be a typo
-
- Posts: 64
- Joined: December 24th, 2012, 6:56 pm
Re: [help] C# and multithreading
Nope, just copied thisjsmorley wrote:Why the term "Ruly"? Did you just open a dictionary to a random page and point at a word?
http://www.albahari.com/threading/part3.aspx#_Abort
We can rename it if it don't match.
-
- Posts: 232
- Joined: July 1st, 2011, 1:32 am
- Location: US
Re: [help] C# and multithreading
The canceler is from here, and the name is from here. (Think "unruly".) Though you're right, I'm not sure it's actually needed for something this lightweight.
Also, '_someVar' is just a convention for private variables in C#, because of the way it handles class field access. '_someVar' is the private field, 'SomeVar' is it's public accessor/mutator.
Update: Beaten to the punch.
Also, '_someVar' is just a convention for private variables in C#, because of the way it handles class field access. '_someVar' is the private field, 'SomeVar' is it's public accessor/mutator.
Update: Beaten to the punch.
Flying Hyrax on DeviantArt
-
- Developer
- Posts: 22629
- Joined: April 19th, 2009, 11:02 pm
- Location: Fort Hunt, Virginia, USA
Re: [help] C# and multithreading
Ok, not any standard I have ever used, but to each his own.Aragas wrote:It's a standart:
_variableName is for private variables
VariableName for public
variablename...must be a typo
http://msdn.microsoft.com/en-us/library/ff926074.aspx
-
- Developer
- Posts: 22629
- Joined: April 19th, 2009, 11:02 pm
- Location: Fort Hunt, Virginia, USA
Re: [help] C# and multithreading
Anyway, arguing about naming conventions is the road to hell.
-
- Posts: 64
- Joined: December 24th, 2012, 6:56 pm
Re: [help] C# and multithreading
You know, all our problem caused because Rainmeter is using .net 2.0
Can we upgrade this at least to 3.5? There are async methods that we could use and say goodbye to threads.
Can we upgrade this at least to 3.5? There are async methods that we could use and say goodbye to threads.