I need to make my program only one process on several platforms. I have known it can be solved with mutex on Windows, but I don’t know how are other plat-forms like Linux. Mutex is not a part of C++ 03 standard though it is in C++ 0x standard. I have to wait a long time before compilers support C++ 0x well. Can boost’s mutex be used for this?
Thanks in advance 🙂
Have a look at boost’s interprocess library: http://www.boost.org/doc/libs/1_47_0/doc/html/interprocess.html
I have used a named_mutex http://www.boost.org/doc/libs/1_47_0/doc/html/boost/interprocess/named_mutex.html to make sure only one instance of my program was running.