Not able to create multi-threads after increase mqueue message size

298 views Asked by At

In my C software I created 10 threads (multi-thread) and write messages in a message queue. I also created 1 more thread to monitor the queue and drain data out from the other end of the queue.

It ran ok, but the message size was stuck as default (10).

I learnt from the forum to increase the mqueue size by running "echo number>/proc/sys/fs/mqueue/msg_max", where I put "number" as 100 in Linux (Ubuntu).

However after this change, when I execute my software again, I'm not able to create (pthread_create) more than 4 threads. The other 7 threads creation report errors. Everything was ok before apart from the queue was too small.

Please may I ask how can I restore the default value of the msg_max so that I can run the software again?

Also is there any other way to increase the mqueue size?

Thanks a lot.

Cheers,

Janice

1

There are 1 answers

0
Armali On

We tried 10 > /proc/sys/fs/mqueue/msg_max and everything is fine again. – Janice Man