Skip to content
Advertisement

Tag: c++

Physical disk block size on POSIX using C/C++

I’m working on a high performance I/O program and I’m trying to find the best way to determine the _physical_ (and not the _logical_) byte size of a device’s disk blocks with C++. My research so far has led me to the following code snippet: The man pages says the following about st_blksize: The st_blksize field gives the “preferred” blocksize

C code with ncurses compiled with libtinfo dependency

I’ve recently written a minesweeper implementation in C using ncurses on linux; everything works fine on my pc, but if I try to give the compiled binaries to someone else they often get the error: error while loading shared libraries: libtinfo.so.5: cannot open shared object file: No such file or directory If I have them recompile the code everything’s fine.

Sending signal to pthread to abort sleeping

I’m have a pthread function, which sleeps most of the time using usleep() I would like to send a signal from the main process to the thread to interrupt the sleeping sometimes. The problem is that I can’t find any reference of which signal exactly to send using pthread_kill() the usleep() man page, states that SIGALRM should not be used

how to give more than one c file as input to GNU Cflow?

I was able to generate the callgraph of one file using gnu – cflow, but I was not able to find out how to generate the call graph for multiple files using cflow. I tried following cflow test.c,hello.c It generates the callgraph for test.c and not creating it for hello.c cflow test.c hello.c It generates the callgraph for hello.c and

Mutex lock threads

Am new to multi threaded/processs programming. So here’s what I need to clarify. Process A code With the above pseudo code, is process B able to access sharedResource if mutex is not unlocked? How can I access the sharedResource from process B correctly? Any there any clear visual diagram that explains the relationship between mutexes, threads and processes? Answer What

Advertisement