Friday, May 15, 2020

Digest for comp.lang.c++@googlegroups.com - 25 updates in 8 topics

"Alf P. Steinbach" <alf.p.steinbach+usenet@gmail.com>: May 13 03:36PM +0200

On 13.05.2020 08:29, Bonita Montero wrote:
 
> You're such a mega-idiot. That's not industrial-level code, it's
> expermental to allow to prove Öö Tiibs assumptions. And for this
> puprose it is completely adequate.
 
If it doesn't need to be correct it can be arbitrarily simple and fast.
 
- Alf
Bonita Montero <Bonita.Montero@gmail.com>: May 15 05:26AM +0200

> You never would have thought about EINTR.
 
That's not necessary here because EINTR terminates
the program when you don't catch ^C.
red floyd <no.spam@its.invalid>: May 14 09:48PM -0700

On 5/14/20 8:26 PM, Bonita Montero wrote:
>> You never would have thought about EINTR.
 
> That's not necessary here because EINTR terminates
> the program when you don't catch ^C.
 
I'm glad you never write programs that catch SIGINT.
Other people, however, do write them.
red floyd <no.spam@its.invalid>: May 14 09:48PM -0700

On 5/14/20 8:26 PM, Bonita Montero wrote:
>> You never would have thought about EINTR.
 
> That's not necessary here because EINTR terminates
> the program when you don't catch ^C.
 
I'm also glad you don't write programs in non-canonical
mode *cough*ncurses*cough*
Bonita Montero <Bonita.Montero@gmail.com>: May 15 08:06AM +0200

> I'm glad you never write programs that catch SIGINT.
 
I've written such programs an they handle it properly.
But here that's not necessary.
red floyd <myob@its.invalid>: May 15 10:10AM -0700

On 5/14/2020 11:06 PM, Bonita Montero wrote:
>> I'm glad you never write programs that catch SIGINT.
 
> I've written such programs an they handle it properly.
> But here that's not necessary.
 
So you know that NOBODY in the world who may wish to use your mutex will
EVER write a program that traps SIGINT. Damn, I wish I was as psychic
as you.
Bonita Montero <Bonita.Montero@gmail.com>: May 15 07:19PM +0200

>> But here that's not necessary.
 
> So you know that NOBODY in the world who may wish to use your mutex will
> EVER write a program that traps SIGINT.
 
The mutex is not a general-purpose mutex; it is only to prove Öö
Tiib's assumptions - or not. Therefore it doesn't need to care
for SIGINT, resource-collapse or destruction.
 
> EVER write a program that traps SIGINT.
> Damn, I wish I was as psychic as you.
 
I'm not psychic, but you're stupid.
Bonita Montero <Bonita.Montero@gmail.com>: May 15 07:22PM +0200

If you really need a decent semaphore-class, here's one I've written as
I wrote my lock-free LRU-algorithm:
 
#pragma once
#if defined(_MSC_VER)
#include <Windows.h>
#include <intrin.h>
#elif defined(__unix__)
#include <semaphore.h>
#include <pthread.h>
#include <errno.h>
#include <sys/types.h>
#include <sys/ipc.h>
#include <sys/sem.h>
#include <sys/stat.h>
#include <climits>

No comments: