fifo

FIFOs implementation

Consider the following code: writer.c mkfifo("/tmp/myfifo", 0660); int fd = open("/tmp/myfifo", O_WRONLY); char *foo, *bar; ... write(fd, foo, strlen(foo)*sizeof(char)); write(fd, bar, strlen(bar)*sizeof(char)); reader.c int fd = open("/tmp/myfifo", O_RDONLY); char buf[100]; read(fd, buf, ??); My question is: Since it's not ...

C Named pipe (fifo). Parent process gets stuck

I want to make a simple program, that fork, and the child writes into the named pipe and the parent reads and displays from the named pipe. The problem is that it enters the parent, does the first printf and then it gets weird, it doesn't do anything else, does not get to the second printf, it just ways for input in the console. #includ...

problem with fifos linux

I am having problem debugging why n_bytes in read_from_fifo function in client.c doesn't correspond to the value written to the fifo. It should only write 25 bytes but it tries to read a lot more (1836020505 bytes (!) to be exact). Any idea why this is happening? server.c: #include <stdio.h> #include <stdlib.h> #include <string.h> #inc...

UNIX FIFO: How to allow only one writer/reader pair to use a FIFO?

Hi! I've written two programs: the first, the "writer", creates a FIFO and writes data into it. The second one, the "reader" runs in background and looks for data in the FIFO. Once data is there, the reader reads it out. If I start e.g. two writers and two readers, they all can write/read into/from the same FIFO. How can I restrict it ...

optimistic lock-free FIFO queues impl?

is there any C++ implementation (source codes) of "optmistic approach to lock-free FIFO queues" algorithm? ...

When someone says " device, fifo or filename to write yuv frames too" what does fifo mean here?

I am reading docs for VLC Command line programming. there I saw YUV video output --yuv-file=<string> device, fifo or filename device, fifo or filename to write yuv frames too. What does device and fifo mean? how to specify them? ...

How to work with "fifo" in C# .net?

How to work with "fifo" in C# .net? (is it possible in .net 3.5 in 4.0?) ...

Fober et al Lock-Free FIFO Queue: multiple consumers and producers?

Hi, I was wondering if the fifo queue presented in Fober et al's paper http://nedko.arnaudov.name/soft/L17_Fober.pdf was a multiple consumer and produce fifo queue. If not, which is the best documented multiple consumer and producer FIFO queue? Thanks ...

How can I manage a FIFO-queue in an database with SQL?

I have two tables in my database, one for In and one for Out. They have two columns, Quantity and Price. How can I write a SQL-query that selects the correct price? In example: If I have 3 items in for 75 and then 3 items in for 80. Then I have two out for 75, and the third out should be for 75 (X) and the fourth out should be for 80 (Y...

Connecting std::basic_ofstream<unsigned char> to a FIFO. bad_cast exceptions

Using gcc 4.4.3 on Linux 2.6.32, I get bad_cast exceptions when connecting std::basic_ofstream to a FIFO. Stepping though the debugger, I can see that the error is generated at various places in the standard library because the _M_codecvt member of the stream or filebuf object is NULL. Exactly where it happens depends on the order of op...

FIFO implementation

While implementing a FIFO I have used the following structure: struct Node { T info_; Node* link_; Node(T info, Node* link=0): info_(info), link_(link) {} }; I think this a well known trick for lots of STL containers (for example for List). Is this a good practice? What it means for compiler when you say that Node has ...

Is there any tutorial on connecting .NET 4 Pipeline with Pipeline from some C\C++ programm?

Is there any tutorial on connecting .NET 4 Pipeline with Pipeline from some C\C++ programm? For example how to get data from VLC Pipeline output ... I mean VLC docs say that there command line args can eat name of pipe like YUV video output --yuv-file=<string> How to give such name to pipe created in your .Net programm so to be...

I Have a problem with 2 FIFO for read and write in each

The attached code should allow the communication between 2 terminals. The communication is made through 2 FIFO, which are created in the current directory. The program has to open the 2 fifos and the son reads from STDIN and puts on the fifo1 and the father reads from the other fifo and prints on terminal. In this way the communication t...

Having trouble getting a Unix FIFO to work properly?

I'm trying to write a simple daemon in Linux, which will create a FIFO, then collect anything written to the FIFO and write that data to a file at a later time. My expectations are that once my daemon has created the FIFO, I can do "echo text > /myfifo" repeatedly. When I'm done, I can do "echo quit > /myfifo" and my program will exit a...

How to build an undo storage with limit?

Dear All, I want build a data structure to store limited undo buffer, take store 6 dict data for example with below pseudocode: rawdict1 = {1} buffer = [{1}] rawdict1 = {2} buffer = [{2}{1}] # {1} stored on the postion rawdict1 = {3} buffer = [{3}{2}{1}] ... rawdict1 = {5} buffer = [{5}{4}{3}{2}{1}] # max length limit...

Can I read and write a FIFO from concurrent threads in .NET?

I'm using a Queue<T> for caching video. The idea is to fill it with data (Enqueue), start playing (Dequeue) and fill back continously as data arrives. Can I do the filling back part from a background thread? ...

How do I read a FIFO/named pipe line by line from a C++/Qt Linux app?

Hi How do I read a FIFO/named pipe line by line from a C++/Qt Linux app? Today I can open and read from a fifo from a Qt program, but I can't get the program to read the data line by line. Qt reads the entire file, meaning he waits until the "sender" closes his session. Let's take a example with some shell commands to show what I w...

Make my own FIFO Queue class for my own class object to fill it?

Hello. I am trying to make a FIFO Queue that is filled with my own class object. I found this example but if I replace < E > with < PCB > it does not work: import java.util.LinkedList; public class SimpleQueue<E> { private LinkedList<E> list = new LinkedList<E>(); public void put(E o) { list.addLast(o); } public E ge...

Can a C# blocking FIFO queue leak messages? What's wrong in my code?

Hello, I'm working on an academic open source project and now I need to create a fast blocking FIFO queue in C#. My first implementation simply wrapped a synchronized queue (w/dynamic expansion) within a reader's semaphore, then I decided to re-implement in the following (theorically faster) way public class FastFifoQueue<T> { priva...

Implementing a FIFO queue in C (not C++ nor C#)

For an embedded application, I am trying to implement a first-in, first-out (FIFO) queue of structs using ANSI C. The most straightforward way to do this seems to be by implementing a linked-list, so that each structure contains a pointer to the next in the queue. Hence I define the struct itself as: typedef enum { LED_on, LED_off, etc ...