« first day (918 days earlier)      last day (4025 days later) » 

user142019
9:00 PM
Windows? Who cares about Windows?
 
Oh.
Well then.
 
@Zoidberg Were both on Windows you twatberg :P
 
user142019
There is a Windows port. github.com/DrPizza/libdispatch
 
lol DrPizza
 
A long time ago someone told me how to better write this, so it's not good for use.
But this was my Dispatcher, which operated on a single thread: coliru.stacked-crooked.com/…
 
9:02 PM
@Zoidberg 90% of the PC market.
 
This was before I learned that trick that DeadMG taught me with some base class trickery.
So I could very heavily change this to take in arbitrary units of work and not bother with all the implementation details, and also use variadic templates.
Once that's done, I just have to have one Dispatcher per spinning thread on my ThreadPool, and I'll be done.
 
user142019
@EtiennedeMartel That is SO mainstream! </hipster>
 
I'll use my WaitEvent class to keep CPUUsage of the dead threads down to zero, and after 2 WaitEvent timeouts, I will kill the thread and mark it as dead and ready for reopening.
 
spinning thread?
 
Spinning Thread - a thread that's taking CPU time and doing work.
 
9:06 PM
Why don't you just use a blocking queue of work units and have the threads pop from it?
 
At most I will have std::thread::hardware_concurrency() threads (or whatever that function name is to get the number of threads on a PC)
 
user142019
Beware.
 
user142019
It may return zero.
 
@R.MartinhoFernandes Well, that's the change I need to make to Dispatcher. Right now, it keeps its own work list. If I have one per thread then the work will already be pre-separated. Instead, I'm going to move the list into ThreadPool and the dispatcher will pull from that list (std::mutex locks around the list).
 
user142019
You don't want zero worker threads. :v
 
9:08 PM
@ThePhD I wouldn't necessarily set that as a hard limit
 
@Zoidberg I'll use threadcount = min(2, threadcount) to keep it alive, I guess?
 
say the work you are doing is downloading crap from the web - 4 or 8 threads might not get optimal throughput there :p
 
user142019
@ThePhD Use max, noob.
 
@ThePhD Badness.
implement an interface similar to the one in PPL, that's goodness.
 
1
Q: Visual Studio 2012 lambda with unique_ptr argument regression?

ZadirionI was surprised to find in Visual Studio 2012 Update 1 the following does not compile anymore: auto lambda = [](unique_ptr<int>){}; Compiler error states it can't access the private copy constructor of unique_ptr. The above worked just fine in Visual Studio 2010. It also compiles just fine i...

^ that's a hairy one
 
9:09 PM
@DeadMG Never messed with PPL.
 
@ThePhD The Standard threading stuff is vastly inferior.
 
Ell
@BartekBanachewicz do you use a glID class? If so how do you deal with different deleter signatures?
 
PPL ships things like parallel_for_each.
 
user142019
@Ell You can use std::function and std::bind for glDeleteBuffers and similar functions.
 
9:11 PM
@Ell handle class. <3
 
user142019
I think.
 
Ell
Yeah I think I might be able too use bind
 
Ugh, char[2] style traits.
 
@R.MartinhoFernandes I have no other idea how to do it, though. :O
 
9:16 PM
@ThePhD I imagine there might be other (more legitimate :p) scenarios where the individual threads do very little work, where using more than std::thread::hardware_concurrency() would be desirable?
 
@melak47 Look at implementation of parallel_for_each.
 
@melak47 True enough. I could just set it as a default, then.
As in "this is a good number of threads to have. For now."
"Expand if we've got a whole lot of work on the back logs."
 
@ThePhD wheels::TraitOf <3. No idea if it works in MSVC though.
 
@DeadMG ?
 
@R.MartinhoFernandes You don't have to do char[2] style traits in MSVC.
@melak47 They do stuff like chunking work.
 
9:18 PM
@melak47 If your work can block in I/O, more than hardware_concurrency is probably worth it.
 
Xeo
@R.MartinhoFernandes no using aliases
 
Not really a blocker, though.
 
Xeo
So it's more cumbersome
Well, yeah, C++03-style template typedefs still work
 
Just ::type actually.
 
@DeadMG why are you telling me this
 
9:19 PM
Or not even that.
 
@ThePhD is the one making a thread pool
 
@Xeo No variadics is a bigger pain.
 
Xeo
heh
 
TraitOf can make any n n-ary traits.
 
Huh. Oh. So the 'install form the internet' was the clue, then. I'd glossed over that, since it seemed so obvious. Well, then, it appears to be useful, even though I missed it. (Revenge downvoting, though, is never useful) — sehe 41 secs ago
The guy revenge downvoted in the most transparent fashion - lol
 
9:22 PM
5 mins ago, by melak47
@ThePhD I imagine there might be other (more legitimate :p) scenarios where the individual threads do very little work, where using more than std::thread::hardware_concurrency() would be desirable?
 
@sehe I never comment when I downvote to avoid that.
 
increasing the number of threads isn't the solution, it's chunking the work.
 
@Borgleader really? chicken :)
 
Xeo
Hm, I just noticed I finished the Functor to Monads to Zipper section of Learn You A Haskell
 
@sehe guilty as charged ^.^
 
user142019
9:23 PM
I only comment when downvoting when it's not hopeless.
 
@Borgleader For context, I deleted my earlier comments, so the whole deal might not make much sense anymore
 
user142019
And in most cases it's hopeless.
 
@DeadMG but what if the work actually does work on the CPU
 
chunking is still a superior approach
if you have light work, the costs of synchronization per element will kill you
if you're incrementing each element in parallel, the cost of locking the lock to dish out the work is going to be miles higher
chunking massively reduces this problem
 
@Xeo And, suicidal or hyper?
 
9:25 PM
it's not worth using if you know in advance you're doing some pretty heavy work per element
 
user142019
Use only immutable data.
 
user142019
No more synchronization!
 
@Xeo it's almost funny..intellisense just seems to read using aliases as typedefs, but the compiler is all like "no soup for you! Come back one year" :(
 
Xeo
@melak47 Yeah, the EDG frontend is more advanced than cl here :D
@sehe more hyper
I like Haskell, and I like type classes / Monads
 
9:28 PM
> There is no add_value function. ptree docs
^ lol @ Boost Property Tree docs
 
Actually not that bad.
 
Xeo
template <typename T>
struct has_arithmetic_type : trait_of<has_arithmetic_type_test, T> {};
As I said, C++03-style template typedef :)
Sometimes, I'm wondering if I should use template<class T> struct X : Y{}; or template<class T> using X = Y;
 
I use template <typename T> struct has_arithmetic_type : wheels::TraitOf<has_arithmetic_type_test, T> {}; normally.
 
@Xeo You know, you want using if you want equivalence. You want the derived struct if you want ... derived types
 
user142019
> Do you want this program to make changes to your computer?
 
9:31 PM
(and if it doesn't matter, you choose whatever is portable enough)
 
user142019
Rather not, but sure go ahead and install some software.
 
@Zoidberg 3...2...1...you're fucked!
 
Xeo
@sehe I meant specifically for traits
 
@Zoidberg If you don't want a program to make changes to your computer, better have a circuit breaker handy
@Xeo Oh well, then it's just about portability to decide.
 
struct is lazier than using.
 
9:33 PM
Oh. I never realized that
 
It can avoid unnecessary instantiations.
 
Darn. Twice now, I have accidentally closed the browser doing ^Q instead of ^W. I'll go to bed early today
 
Xeo
I'll hit the sack too.
G'night
 
user142019
@Xeo Hit the sack? NSFW NSFW NSFW
 
@srf Good. Cheers and hope to see you around (I intend to remove the noise from these comments shortly. Thanks) — sehe 7 secs ago
 
9:37 PM
@Zoidberg WTF WTF WTF?!
you play quite weird games
 
user142019
Yes I link it here so I play it.
 
sbi
I shaved with one of my wife's vagina razors and now my face won't stop bleeding I may have just found the cause of that whole period thing
3
 
Everybody is playing it now :)
 
sbi
Good evening.
 
Hello
 
user142019
9:41 PM
@sehe lol
 
Vagina razors!? She's doing it wrong! And he's doing it wrong too!
 
sbi
@sehe What's opaque to me is why you posted that as a reply to my message.
@je4d Standards meeting? I rather took a week off and dug through my garden. :)
 
 
Is it possible to make a threadpool without some sort of infinite loop in it? I've seen 2-3 implementations so far and they all used infinite loops.
 
sbi
9:45 PM
@sehe I doubt that, because it was only shot this week.
 
what's wrong with inifnite loops? for(;_;)
 
@kbok I think it's a one-screen-wall-o-text
 
@sbi Oh sorry. That's still an old quirk with SO Chat (maybe just on opera?). It likes to remember any old message I was typing. And in this case, it appears I might have, at one time, clicked the 'respond' arrow on a message of yours. Usually, I do notice, but these days "quotation" markdown works so well .... I didn't notice the 'in-reply-to' arrow...
 
@melak47 It'll block my main thread?
 
@Abyx It's a wall of code.
 
9:46 PM
@Borgleader see what you did? now the infinite loops is sad :(
 
sbi
@sehe Actually it was just that I got busy with work, and the kids, and the rest of life.
@sehe I think only you ever did that.
 
@kbok but it looks like a text
 
@sbi So that'd make it a Opera specific thing. I might ask others if only I remembered who the other Opera fans here were :|
 
sbi
 
9:47 PM
lol
 
@kbok why only from a lambda?
 
sbi
@sehe I don't think there are any.
 
lol
@sbi har har. go on, I like being trolled :)
 
@Abyx From any non-overloaded, non-templated function object, actually.
 
sbi
@sehe Actually, I genuinely believe that.
 
9:48 PM
@sbi I don't doubt that
 
user142019
@sbi I never curse. I never smoke. I never drink. God dammit, I dropped my cigarette in my beer!
 
@kbok yeah, and why not function pointers?
 
@Abyx Function-pointer-to-std-function is trivial to implement
 
@sbi woah
 
user142019
9:50 PM
> With the new feedback feature, Coliru is now 20% cooler!
 
user142019
Cooleru
 
My girlfriend has a bunch of really cute little white rabbits
 
user142019
You know what kind of meat I like? Rabbit meat.
 
user142019
Delicious.
 
Ell
@sbi d. Inconsistency
 
9:51 PM
@melak47 Nevermind what I said earlier, I'm a fucking idiot.
5
 
sbi
@Mysticial What? You don't like the hare?
@Ell Pardon?
 
Please tell the infinite loops I'm sorry
 
@sbi I like it. It also scares me. :)
 
@kbok, I think you should use type instead of function_type
 
sbi
@Mysticial I think it worked hard on that. :)
 
9:52 PM
@Abyx sure.
 
sbi
Here's one for @Tony.
 
@Borgleader when you say that, everyone stars it. When I say that they just laugh at me :(
 
Ell
@sbi relating to that picture you posted, add "d. Inconsistency" on the end
 
user142019
 
sbi
@melak47 Actually, that's wrong. It's one of the oldest traditions of this chatroom that, whenever people say anything about themselves being idiots, it gets starred. Of course, nobody will star such a message by you when they suspect you're fishing for the stars, but only when they feel like you could be embarrassed by this being on the starboard. (And, yes, this means that now that we all know you'd like to be starred for such, we'll never do.)
@Ell Ow. Even now that you explained it, it took me a while.
 
9:56 PM
I'm an idiot.
 
@sbi my plan succeeded! now I can do all the stupid stuff I want and don't get it starred to be berated for it!
 
user142019
@R.MartinhoFernandes I agree.
 
sbi
@R.MartinhoFernandes You drunk again?
 
eurgh...should I be worried?
 
sbi
@melak47 Ha, that was pretty clever. Unfortunately, so are we.
 
9:57 PM
looks like fried GPU
 
@melak47 Hah your VS has been redacted!
 
@DeadMG happened when I moved the window from one GPu to the other
 
sbi
@melak47 Nope. Those ALL-UPPERCASE MENUS are what it is supposed to look like.
 
@Borgleader lol
 
sbi
9:59 PM
@R.MartinhoFernandes What happened? Oh wait. Which Sunday?
 
Ell
@sbi haha it wasn't that bad ;)
 
sbi
@R.MartinhoFernandes Is that supposed to be an answer to my first question?
 
No, the last one.
 
sbi
@R.MartinhoFernandes The last Sunday?
 
10:00 PM
Oh god.
 
sbi
Yes?
 
What happened was that everyone involved in said plans woke up too late with a headache. The Sunday in question was yesterday, 21st April 2013.
Clear now?
 
What do you mean yesterday? Sunday is today =/
 
@Borgleader not anymore :)
 
well it is for me :P
 
sbi
10:02 PM
@R.MartinhoFernandes Ow c'mon. You shot me some random fact without context and then expected me to ask all the right questions for you to grudgingly answer them. You should know that this old trick doesn't work with me.
 
What's a verb to describe walking and thinking deeply? (ie, a synonym of 'walk')
 
as of two minutes ago, it's Monday D:
 
sbi
@Borgleader That was meant for me, and for him and for me it was 0:01 when he posted that. (It's no god being a pedant when you're a bad pedant.)
 
@Crowz That's not a synonym of 'walk'.
 
oh wait, I don't have anything on Mondays :D
 
Ell
10:03 PM
Not for me =D
 
yaay monday :D
 
@R.MartinhoFernandes connotations yo
 
Ell
Mondays are hard >.<
 
sbi
> Look, Monday, I don't think you know who you're fucking with here. — Nein
 
10:06 PM
@Borgleader were you gonna say something?
 
Huh?
 
if that's an image, I don't see it
 
Probably a facebook image
I have fb blocked so it just shows it loading indefinitely.
 
oh. I blocked that
 
hip hip.
 
10:09 PM
I just see a blank post
 
@sbi By now you should know I'll never learn.
 
sbi
@R.MartinhoFernandes I guess I'll never learn that.
 
@melak47 Yes it is an image
I got it from google but the url seems to suggest it's hosted on FB's servers
 
@Borgleader yeah I got it :)
 
sbi
Was that really so hard?
Tsk. Those young people today. In my youth, we had to get out our pencils if we wanted to share pix.
 
10:13 PM
@sbi Did you ever try to use a pantograph?
 
sbi
Anyway, while you guys are still pondering why I slapped you, I gotta go to bed. My alarm goes off in 5.5hrs.
Good night!
@JerryCoffin I hated those!
Also, Hi @Jerry! Good night, @Jerry!
 
@sbi Good night!
@sbi Notice I said "try"!
 
@sbi night
 
user1174868
I suck at everything I do
 
@Jordan so go do nothing, suck at that, and be super productive!
 
Ell
10:18 PM
I'm sure that isn't true jordan
For some reason I think Jordan is @chimera
 
@DeadMG Well, how to you decide to "chunk" work?
Referring to PPL and stuff like that?
Randomly? Do you just dish it out to X threads based on which thread is the least clobbered at the time of work/chunk insertion/creation?
How many new threads do you create? How many different threads do you pass work to? I mean, the only way to know for sure how much time / how much it will cost to run a single unit of work is to do the work.
@bamboon You mentioned exception safety for a thread. This is only in the case where the work you queue up actually blows up with an exception, right?
If you don't explode with an exception, then there is no reason to actually transport or even propogate that exception. Like C#, C++ has the model of std::terminate-ing the thread if an exception explodes and is unhandled in it. So, I'll follow the same model: catch your own goddamn exceptions like a wise programmer. If you're only doing integer math or something, there's no reason to catch exceptions because there's not going to be any.
If anything, the wrapper I write around std::thread will just try { } catch { } around the work it has to do, and if it fails, it will immediately std::terminate that thread and put up a new thread to be created.
 
10:33 PM
how does queueing up work anyway? do you queue up data, and give your threadpool one lambda/function that processes data, or do you package data and the function to work on it into one work item?
 
@ThePhD Do you think this shit up randomly?
std::terminate takes down a program, not a thread.
 
@R.MartinhoFernandes Oh. I had no idea. :D
 
Why kill a thread if some work fails?
 
@R.MartinhoFernandes Then I guess I try/catch around work and ignore any exceptions you don't personally catch. :D
 
10:35 PM
@ThePhD You check the size of the input, you measure how much it costs to get a new chunk, you compare the two.
@ThePhD You std::terminate().
 
You put the exception in the promise :<
 
Ell
I watched a video about futures and shiz a while ago
I've forgotten most of it now :(
 
@R.MartinhoFernandes Well, if the work you queues up throws an exception and you don't catch it.... in a regular program, that program would just die, right?
Why should I hand out something different than what is expected? (Thread / Program death?)
 
In OpenGL, what's that word for when something is in front of something and blocks your site of the thing behind? Something like occulating?
 
I don't see any benefit of taking the time to tell you "by the way, that work you queued up 20 minutes ago just FAILED HORRIBLY and you didn't catch the exception. :D"
 
10:37 PM
Why is program death expected? Presumably, whoever queued up the work knows how to deal with failure.
 
occlusion?
 
@Crowz Occlusion. It's English actually.
 
@R.MartinhoFernandes But they didn't.
 
They didn't what?
 
deal with failure
 
10:38 PM
@DomagojPandža and the verb form is "occulating"? eg, "this shape is occulating this shape"
 
Within the work unit. So what?
 
Occluding.

occluding present participle of oc·clude (Verb)
Verb
Stop, close up, or obstruct (an opening, orifice, or passage).
Shut (something) in: "they occluded the waterfront with buildings"
 
@Crowz occlude
 
I mean, it depends on where you expect error handling to be done.
Should it be done in the unit of work?
 
Okay, that's why spell check is complaining
 
10:38 PM
Should it be passed back through a callback?
 
@R.MartinhoFernandes You can only rethrow one exception on the calling thread, so unless you choose to go for an aggregate-exception style approach, you have to go with nothrow- which means std::terminate() if it throws.
 
@ThePhD And returns what?
 
@R.MartinhoFernandes Returns on investment.
 
Quick question: does anybody think it's worth the time to expand the code in this answer to use a variadic template for the ctor, so you could pass things like multi::stream(std::cout, "myfile.txt");?
 
@JerryCoffin Do you know what adding a variadic ctor entails? It may end up being chosen over the copy constructor to make copies.
If you want to do it right it means a bit of unrelated code.
 
10:41 PM
@R.MartinhoFernandes So then you're expected to hold the exception and then cart it out in a std::future ?
 
@R.MartinhoFernandes I haven't tried it, so I doubt I know all the details, but I'm vaguely aware. And yes, I was aware it can be used for copying instead of the copy ctor (I remember the question litb asked based on that).
 
std::future<either<T, E>>
 
@CatPlusPlus futures already have exception support. future<T>.
 
Yeah I guess
 
@ThePhD How do you cart out the result?
 
10:42 PM
That whole conundrum with exceptions is silly
 
@R.MartinhoFernandes std::future, I mean. You're expected that - when it fails - to cart out the exception. And then what, you just leave it up to the user to handle that exception?
 
@R.MartinhoFernandes Yeah -- that's why I was asking -- if it was quick and simple, I'd just write it and be done.
 
@JerryCoffin I wouldn't.
@ThePhD So you are already using futures, but want to not use them for the exceptions?
@ThePhD I meant, how do you cart out the result when it succeeds?
 
user142019
Lounge<C++> is the best lounge in the world.
5
 
@ThePhD Wherever you process the value, you also handle the exception?
 
10:43 PM
@R.MartinhoFernandes Oh. With a std::future.
 
This really is more obvious with Either
 
@Zoidberg what's with the ponies
 
user142019
The lounge lacked them.
 
user142019
And OMG PONIES.
 
~_~
 
10:44 PM
@melak47 I refreshed when you said this, and now I'm staring at some purple creature. =[
 
Buttcoiners, ponies
Lounge is going down
 
There's a buttcoiner in the Lounge?
 
user142019
Soon this will be Lounge<Pony>.
 
At least two
 
Hm.
Though since I'm handling the work myself...
 
10:47 PM
@CatPlusPlus Who?
 
No, wait, std::future should be just fine, I think.
 
Rapptz and someone new I guess not a regular yet
 
yesterday, by Rapptz
Also, full disclosure. I don't have any BTC.
 
It was yesterday actually
Woah I just have no sense of time flow
 
=[
I can't create a std::future manually myself?
 
10:49 PM
Or reading comprehension :|
 
@ThePhD You can
Well, with a promise
 
Oh.
So I use std::promise and then get_future
But there's no way to construct a future explicitly on my own.
 
Yeah promise is the writing end of a future
@ThePhD Not a useful one no
 
I also have to use promise.set_value() to set the result of the function.
 
Yes
On the writing end you have to also catch exceptions and use promise.set_exception
 
10:52 PM
So I guess I'd keep a list of promises, set their value if the function works, and in the case of an exception, set the exception instead.
@CatPlusPlus Ah, okay.
Maybe I could pass out std::promise's instead of std::future's ?
 
You pass promises to the worker threads, futures to the clients
 
Oh, okay.
On the whole, really what I'm doing is reinventing std::async, but with the benefit now that I can re-queue work on a thread without letting that thread automatically die when its done doing its work.
 
inb4 packaged_task
 
@LucDanton ?
 
@melak47 It's a path well tread.
 
10:55 PM
@ThePhD Async is sufficiently broken that I wouldn't blame you, but I disapprove of that interface in general. Parallel algorithms are better.
 
Eh, parallel algorithms aren't really the same thing
 
@DeadMG I'll do that too, but the need for a ThreadPool is a different need from the need for Parallel_For_Each.
 
With async/threadpool you really want to just throw something into the background and do something else in the meantime
 
a ThreadPool takes a single unit of work and blocks a single thread on that work. Parallel_For_Each spawns what is basically its own ThreadPool and runs as many different pieces of the algorithm simultaneously.
 
^ any feedback?
 
10:58 PM
@CatPlusPlus For that, you'd really need real tasks, so more than std::future offers
 
Eh, future works
@kbok What's that for
 
@kbok looks neat. might steal it? :p
 
@ThePhD What would that do?
 
@melak47 Sure
 

« first day (918 days earlier)      last day (4025 days later) »