user2071089 user2071089 - 5 months ago 21
Linux Question

Is it possible to communicate via LINX Communication between threads?

See i know there are various methods to communicate between threads but my question is specific for LINX. Please answer.

Thanks in advance

Answer

threads of the same process share heap staff, synchronized by thread lock, Semaphore and condition variable.

Besides, The communication approach from Interprocess communication(IPC for example, PIPE/FIFO/MessageQueue/SharedMemory/Signal/Socket) works for threads communication, too. take FIFO for example(neglect error code checking):

char buf[110];
char *FIFO = "/tmp/my_fifo";
mkfifo(FIFO, O_CREAT);
int fd = open(FIFO, O_RDONLY, 0);
int nread = read(fd, buf, 100);