Do POSIX threads (managing by pthread library) works parallelly? My lecturer has told us that this library creates only user threads, that are not managed by Linux kernel. I wrote some code that fill large matrix and compared times of execution for threads and whole program and it seems to works parallelly. Can I use this library to creating parallel
Tag: c++
How to extract taskid(tid) of a pthread from the parent thread?
I’m using std::thread to launch threads. Also, I need stats for the worker thread available at /proc/[pid]/tasks/[tid]. I need tid to be able to monitor thread stats. I was wondering if there was a way to extract tid from the parent thread. I know that syscall gettid() from the worker returns its id, but I want the threadId from the
How do I fix “‘struct _IO_FILE’ has no member named ‘_file'”?
I have a version of a program that used to compile to a *.o file, but now it does not, and gives a compiler error. I have tried to compile my code with gcc compiler on Linux, and the compile fails. I expect the command gcc -c isatty.c to yield isatty.o but it does not. Instead, I get this message:
Many-to-one two-way communication of separate programs
I’m trying to make two-way many-to-one communication between programs in Linux. My plan is the following: One program called “driver” that talks with the hardware needs to communicate with an unknown number of applications in Linux. I read that one of the most common ways for inter process communication is “named pipes”. The question I haven’t found yet is: How
can’t access my inherited class attributes
I am working on a project for my job to encode/decode into buffers DNS Records objects in C++. Some records have the same infos, so I created a class Dns message with theses basic infos: The DnsClass and DnsTypes are enum with the differents class/types I use. Then I have my sub-classes for each record, I will take A for
Shell append redirection replaces existing text?
For our school assignment, we have to implement input/output redirection. I managed to get the input and output redirection work, but I am facing an issue with append redirection. I am using testfile.txt: When the user types ls >> testfile.txt, I expect the output from ls to be added to the testfile. At this moment, the test lines get replaced
Is checking the existence of file or folder blocking or non-blocking?
Is checking the existence of file or folder blocking or non-blocking? Is opening dir / file blocking or non-blocking? Is list dir blocking or non-blocking? By block, I mean take a long time to return. Answer (I assume that you mean “block” in the sense that it’s usually used in Unix manpages and related documentation: that is, you are asking
Integer taking a random value after a function call that doesn’t even edit it
I’m executing a program from command line, it takes string integer string string parameters, I call a function that reads the following file: sólo te lo diré mañana al mediodía en la biblioteca It reads the file and prints what it is supposed to print but when it goes back to the main function the value NumHijos takes a random
Automatic variable not expanding properly in Makefile
I am using the following code: However, when I run the code, I receive the following error, implying that $< is not evaluating to anything: When I use the following code… …the Makefile evaluates to the following command… …which is precisely what I would like. However, I do not want to use addsuffix twice. I would like to use $<
How and when are interrupt key combination,such as CTRL-C, translated to signals?
Using a Linux OS, I need to transparently pass all keystrokes from remote connections to local hardware connections. This is fairly straight forward for everything but signals. I know I can register handlers for each signal that capture and pass the keystroke, but this seems like a hack that might not work for edge cases (what if someone changes the