I am getting a seg fault at sem_init. I am trying to create a unnamed sem. Thank you Appreciate some help on this.
sem_t *t;
int status = sem_init(t,1,1);
I am getting a seg fault at sem_init. I am trying to create a unnamed sem. Thank you Appreciate some help on this.
sem_t *t;
int status = sem_init(t,1,1);
This is C API, so all functions use pointers, not references.
Furthermore there are no constructors, hence the existence of
sem_init
which is used to initialize a structure objectt
.It doesn't allocate an object, double ptr would be needed for that.
See e.g.
man 3 sem_wait
for an example.