Skip to content
Advertisement

Tag: c++

Error while trying to compile an c++ sdl2 program with mingw

Basically, when I’m trying to compile my program for windows on linux, I get such an error: My main function starts like this: My compiling script looks like this: And this is my file structure: Any clues on why can’t I compile it? Answer Oh, okay I was just dumb, didn’t pass name of main.cpp to the compiler, and run

Should fsync() be called before or after write() call?

I understand the working of write() call wherein it writes the data only to kernel’s buffers which is later written to disk by kernel after sorting the data optimally. Calling fsync() on file descriptor makes sure that data is written to disk as soon as it’s posted in the kernel’s buffer. My question is, whether fsync() should be called before

Understand shell script interpreter with custom shell [closed]

Closed. This question needs details or clarity. It is not currently accepting answers. Want to improve this question? Add details and clarify the problem by editing this post. Closed 2 months ago. Improve this question I try to understood how shell script interpreter working. for example i wrote custom shell with c++ : now i wrote a script like this

Futex and pthreads issue

I’m testing futexes with pthreads. I’ve written following program: And sometimes it returns 0 as a sum which is proper value but sometimes the returned value of sum is different than 0. My question is why the returned values of “sum” are different than 0? I suspect that there is something wrong with locking but for the moment I cannot

What is the true getrusage resolution?

I’m trying to measure getrusage resolution via simple program: And when I run it, I usually get output similar to the following: ema@scv:~/tmp/getrusage$ ./gt u:0.000562 uz:0.000563 cnt:1 ema@scv:~/tmp/getrusage$ ./gt u:0.000553 uz:0.000554 cnt:1 ema@scv:~/tmp/getrusage$ ./gt u:0.000496 uz:0.000497 cnt:1 ema@scv:~/tmp/getrusage$ ./gt u:0.000475 uz:0.000476 cnt:1 Which seems to hint that the resolution of getrusage is around 1 microsecond. I thought it should be

Writing a small file blocks for 20 ms

I discovered that on my Ubuntu 22 server, attempting to write to a file, often induces around 20ms delay, even when only writing a few bytes. Here is some basic code that demonstrates the problem: And here is the output: It seems more likely to happen if there is a bit of delay between attempts, and also more likely to

Advertisement