I'm porting some old C++ project on Linux (RHEL 5.3).
The situation is the following
#include <semaphore.h>
class OldClass: public sem_t
This used to work because till glibc-2.3.3.20040420 sem_t was a struct. Now, with the newer version of glib is a union =>inheritance not allowed. so the compilation doesn't work.
how it was:
typedef struct { struct
_pthread_fastlock __sem_lock;
int __sem_value;
_pthread_descr __sem_waiting; }
sem_t;
how it is:
typedef union {
char __size[__SIZEOF_SEM_T];
long int __align; }
sem_t;
What would be the best approach to fix this?How can I "wrap" the functionality of sem_t?
Many thanks!
======later edit====================================
OldClass is "later" used by some other class (project is quite big) : therefore, I'm looking for a way to keep the same interface, so I can avoid re-writing all the calls to OldClass.
I was thinking if there a way to create a class MySem_t that wraps around sem_t;OldClass would then inherit MySem_t... does this sound feasible?
Thank you.