Skip to content

Tag: c++

boost timed_wait doesn’t wait if date is in 2116 year

The example: It works perfectly on Linux at the time – the timed_wait waits for 10 seconds and then returns false. However if I move the system date to 2116 year and re-run the app, the timed_wait call returns false immediately. There is the same problem with the boost’s condition vars. Could plea…

Is it safe to assume memory page size is a power of two?

I am currently working on a portable C program which makes use of the memory page size (as returned by sysconf(_SC_PAGESIZE)). I know most often page size is a power of two to allow efficient management using bitwise operations; I found no guarantee of this anywhere, though. So how safe is it to assume page s…

qt run shell commands via qprocess

I am developing a small QT application to interact with the terminal, to send commands to the terminal and to read back information printed out. Example: get output of all processes using ps -aux PROBLEM I am able to write information out to the terminal but I dont think it is in the system scope, actual exam…

How to properly set up ALSA device

Edit: This question is different than the proposed duplicate because I’m asking How do you set the period/buffer size that will work with multiple targets each with different sound hardware?. I have created some code that attempts to set up ALSA before playback of an OGG file. The code below works on on…

uninterrupted execution of Cpp Linux code

Hi is there a method on which I can make my code safe from other OS interrupts etc in Linux GNU? For example if I have the code below and I need to find the exact execution time without other things interrupting my code. I have already looked into pthread_mutex_lock(&cs_mutex); but wasn’t able to st…

compiling c++ projects with dlib library on linux

I want to use dlib library for my c++ projects in linux. I have installed it successfully and able to compile and run the .cpp samples files given under the dlib. I have compiled the sample files through the “g++ -std=c++11 -O3 -I.. ../dlib/all/source.cpp -lpthread -lX11 example_program_name.cpp” …