|
It does block but there's another mechanism that does what you're talking about (not blocking)
It's called awaitable methods and basically they let you return pending a callback . for I/O bound operations, this is particularly desirable, but it's also helpful for CPU bound threads.
The compiler builds a state machine so you can do like
async bool StartJob() {
var result = await DoLongRunningThing(); // method "exits" here,
//pending a callback at which point it picks up here
}
sorry it's a bit contrived, but it's really easy once you get the hang of it.
When I was growin' up, I was the smartest kid I knew. Maybe that was just because I didn't know that many kids. All I know is now I feel the opposite.
|
|
|
|
|
And I thought that C++ was a kitchen-sink language!
That said, good on them that they allow other inputs. Not that I care for RPCs. But if this is in the thread's entry function, it's not much different than accepting any message that could arrive, so it looks like the kind of thing I'd aim for.
|
|
|
|
|
the var declaration is actually typed. The compiler picks up the type implicitly from the return value of the function it was initialized using;
if I do:
var i = 0;
i will be an int.
so i can't later do
i = "foo"; // compile error
it's helpful due to lack of typedefs for example.
When I was growin' up, I was the smartest kid I knew. Maybe that was just because I didn't know that many kids. All I know is now I feel the opposite.
|
|
|
|
|
Port everything to Javascript (node) Problem solved. (just kidding)
|
|
|
|
|
Ouch, that is going to be a mess.
It isnt that threads are difficult, it is that they are a fundamental part of the architecture, and need to go in first, not at the end, as a bodge. Probably better to redesign the whole thing.
|
|
|
|
|
it was fine. all i did is lock down all the non-private methods with a r/w slim lock. it can barely be called multithreaded coding
When I was growin' up, I was the smartest kid I knew. Maybe that was just because I didn't know that many kids. All I know is now I feel the opposite.
|
|
|
|
|
honey the codewitch wrote: when the dictionary is changed the enumerator won't throw like it's supposed to
Are you sure about that?
var d = new Dictionary<int, int>
{
[1] = 1,
[42] = 24,
};
foreach (var pair in d)
{
Console.WriteLine($"{pair.Key} = {pair.Value}");
d[42] *= 2;
} Output:
1 = 1
InvalidOperationException: Collection was modified; enumeration operation may not execute. Dictionary enumerator versioning | C# Online Compiler | .NET Fiddle[^]
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
Yes, I'm sure about that. I'm not talking about the Dictionary class in the BCL
I'm talking about the KwData suite they released on codeplex
When I was growin' up, I was the smartest kid I knew. Maybe that was just because I didn't know that many kids. All I know is now I feel the opposite.
|
|
|
|
|
|
Yup quicker than most 5 year olds at a SINGLE task! AI needs a little maturing IMHO.
Never underestimate the power of human stupidity -
RAH
I'm old. I know stuff - JSOP
|
|
|
|
|
I'm finally at the point where I've made a meal where everything was Sous Vide.
Beef, Carrots and mashed potatoes. All sous vide, and yes it's yummy.
This is partly your fault Griff.
Next level will be everything pressure cooked.
Pressure cooked carrot soup is totally awesome.
|
|
|
|
|
i saw the strangest thing the other day. a recipe for pressure cooked philly cheese steak sandwiches (obviously not the bread!)
i may try it one of these days if i can find a sale on tenderloin tips. i'm a sucker for sales.
When I was growin' up, I was the smartest kid I knew. Maybe that was just because I didn't know that many kids. All I know is now I feel the opposite.
|
|
|
|
|
Jörgen Andersson wrote: This is partly your fault Griff.
Glad to have been of service!
You can't do roast potatoes or Yorkshire puds in 'em, but ...
Sent from my Amstrad PC 1640
Never throw anything away, Griff
Bad command or file name. Bad, bad command! Sit! Stay! Staaaay...
AntiTwitter: @DalekDave is now a follower!
|
|
|
|
|
OriginalGriff wrote: You can't do roast potatoes or Yorkshire puds in 'em, but ...
Is that a challenge?
|
|
|
|
|
No, you'd waste too much food experimenting. Sous Vide can't do "crunchy" because it preserves all the moisture so the surfaces don't dry.
Sent from my Amstrad PC 1640
Never throw anything away, Griff
Bad command or file name. Bad, bad command! Sit! Stay! Staaaay...
AntiTwitter: @DalekDave is now a follower!
|
|
|
|
|
I know.
But then it would be cheating when you finish the steak in the frying pan, right?
I do that for carrots as well. (Sous Vide with salt and butter, then reduce the liquids in a frying pan before glazing them in the reduction for a couple of minutes.)
|
|
|
|
|
Then I cheat, and often!
I do chicken chunks as well - 2.5hr @ 65C
I bulk buy chicken breasts and trim them to 125g or so: the breasts get frozen, the trimmings get Sous Vide then packed in 100g or so bags for the freezer. Then when I want a quick curry, stir fry, or whatever, it's just defrost and it's ready to go.
It's good for fruit as well - rhubarb works well, as does pineapple.
What kind of bags / vacuum system are you using? I started with ziplock, but they were a pain (and couldn't be reused) so I moved to embossed rolls and an "external" pump machine, then moved to a chamber vacuum with "plain" bags this year. Definitely prefer the chamber vac, but it's going to be a few years before it pays for itself in reduced plastic costs!
Sent from my Amstrad PC 1640
Never throw anything away, Griff
Bad command or file name. Bad, bad command! Sit! Stay! Staaaay...
AntiTwitter: @DalekDave is now a follower!
|
|
|
|
|
I'm doing embossed rolls, a vacuum chamber will probably never pay off for me.
I'll try the chicken chunks later.
|
|
|
|
|
I was spending £40 ~ £50 pa on embossed rolls (and getting a lot of failures with the Chinese ones) but for about £15 I get 1000 bags (150x200) and £30 for 1000 200x300 which should last a while ... they do biodegradable ones as well but they aren't suitable for freezers unfortunately.
The chamber vac cost about £300 (cheap Chinese industrial jobbie) but it has the advantage of packing liquids as well as solids. And that was handy when Rich next door was about to drive to Snowden with two big pots full of cawl using just tin foil as a lid ... I figured he'd have to stop outside Brecon and open the tailgate to let the stew out ...
Sent from my Amstrad PC 1640
Never throw anything away, Griff
Bad command or file name. Bad, bad command! Sit! Stay! Staaaay...
AntiTwitter: @DalekDave is now a follower!
|
|
|
|
|
It is just a fancy trend that is a bit pointless though isnt it.
Like Balsamic dressing. Roast vine tomatoes. It will go the way of flared jeans and platform shoes.
|
|
|
|
|
I don't think so.
It's less important for meat actually, that you can do basically as good, without sous vide, if you know what you're doing. Which most people don't though.
The big deal is with vegetables IMHO. They're getting cooked in their own juices, at the right temperature, which gives a lot more intense flavours and the perfect consistency.
But it's not for everyone, and I'm only doing it on weekends, because time. And I like balsamic dressing as well
|
|
|
|
|
So I ended up refactoring and adapting an old microsoft codeplex project for doing an in memory B+ tree, because it was already tested and was released under MPL which is nearly the same license as MIT.
win.
And it's all exposed using a happy dictionary interface.
However, I'm looking to do an ISAM file backed B+ tree.
Well, the problem with that is the records have to be fixed length.
It's a limitation the in memory BPlusTree doesn't share (but honestly should, not for consistency, but for performance although with the GC it doesn't really matter)
fixed length means fixed length strings or *some* mechanism for embedding blob style pointers to fields. (Which also makes them non-searchable through the primary query mechanism - you have to use secondary queries and you can't have these as part of your keys). People familiar with RDBMS systems know these restrictions well.
Also, the trouble with that is I don't know quite how to store those fields.
Currently, the file would be laid out in blocks of fixed lengths. If I start storing blob fields in it, then i lose the fixed block layout and perf that comes with it.
I was thinking of laying out the file in fixed length blocks but having the blobs span multiple blocks. That means a bit of wasted space, but not a huge deal.
It does complicate things though because then i need an additional linked list in the file to find the blob fields quickly by reference - possibly another index.
This is the house that jack built. It has turned into a castle.
Rube Goldberg smirks in my general direction.
*headdesk*
When I was growin' up, I was the smartest kid I knew. Maybe that was just because I didn't know that many kids. All I know is now I feel the opposite.
|
|
|
|
|
Why are you trying to reinvent the wheel?
(because it's fun is a valid answer)
|
|
|
|
|
a) it's fun
b) as far as I'm aware nobody has really made an ISAM DB in C#
c) i'm learning a lot
When I was growin' up, I was the smartest kid I knew. Maybe that was just because I didn't know that many kids. All I know is now I feel the opposite.
|
|
|
|
|
System.IO.File.WriteAllText(@"C:\MyDatabase\store.txt", bPlusTree); BAM! Everything's fixed!
You're welcome
|
|
|
|