Skip to main content
inf's user avatar
inf's user avatar
inf's user avatar
inf
  • Member for 12 years, 11 months
  • Last seen more than 3 years ago
awarded
awarded
awarded
comment
Parallel Quicksort
That's a good idea these days. Guess thread_local wasn't even supported back in 2012.
awarded
comment
awarded
revised
Parallel Quicksort
Unified post after mod removal frenzy
Loading…
awarded
awarded
awarded
awarded
comment
Template vector class
Hi Loki, I was just wondering two things and I am interested in what you think about them. First, shouldn't the unique_ptr<char be a unique_ptr<char[]> so that the correct version of delete is called? Second, don't you have to destroy all already constructed elements in the constructors when a T constructor would throw an exception.
awarded
awarded
accepted
awarded
awarded
comment
std::lock implementation in C with pthreads
To be more precise - assuming that a thread doesn't try to lock a mutex again which it already owns.
comment
std::lock implementation in C with pthreads
Ok, thanks for the hints. Starting with your example, this is of course something I didn't think of as I didn't know that std::lock handles this, I supposed that it acts like a normal mutex::lock which gets double locked. While I can see that a proper ordering would fix the problem in the upper example, would the ordering still matter if we'd assume that the mutexs are both unlocked? I can't come up with a test which would deadlock in that case.