Skip to content

Tag: linux

pointer get wrong value in different thread

I am writing a piece of code to demonstrate the multi-threading share memory writing. However, my code gets a strange 0xffffffff pointer I can’t make out why. I haven’t been writing cpp code for a while. please let me know if I get something wrong. I compile with the command: g++ –std=c++11 …

Save output from ‘stats’ command in gnuplot

I want to statistically analyse outputfiles from a benchmark that runs on 600 nodes. In particular, I need the min, upper quartile, median, lower quartile, min and mean values. My output are the files testrun16-[1-600] with the code: I gain these values and can plot them. However, the tuples from each run get…

Cannot execute command as another user with sudo

I have this code, that is running on tomcat: And my script.sh file: From command line, the script is executed excellent and I see results. But when executing it from tomcat I get this message: I cannot solve this problem. I need your help. P.S: Sorry me for bad english. Thanks! Answer I guess that the problem…

Check if at least one Wayland session is running

I’m using Qt and want to check if any Wayland session is running. For now I have this just for test code, that works as expected: Is it possible to get rid of QProcess and use Linux C++ API? Answer You can try to connect to Wayland. If you can connect to a Wayland composer it is running otherwise is

C system v Semaphore not locking critical region

I have a code that reads an integer from shared memory and then incerements the number in child processes. I’m using semaphore to lock this critical region so that the integer gets only increased if no other process is not increasing it. So I get a stable integer value. I have used SYSTEM V Semaphore fo…

how do I know which package manager in installed on my linux [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers. This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack …