malloc - C: Is there something better than a FIFO Queue implementation for this requirement? -


In one of my programs, there are many clients and each customer has its buffer, in the infinite loop, I check that any The customer has data written on the disk. If this happens, then I do the same and continue.

Now, because the customer writes the data that is not really under my control (some computational results), I need a dynamic buffer. So the phonemic code looks like this:

  // If the data is ready / append (client_id, line) add zero to append (int client_id, char * line) {if (client_id.buffer = = Null) {buffer = (four *) molk (buffers * size (four)); // duplicate line in buffer} else {// redune buffer to non indispensable location and add existing buffer to this line}}  

or another method is to use a simple What message queue do I add to any existing queue (wire) and then read them, is there some other better way?

Maybe I could not fully understand your structure, but my understanding is that a customer will give it to you Id and a four * pass and wants you to write it on disk.

Do you have to copy the original buffer? By doing so, you have two occasions in memory and one chance for memory management. If possible, just work with the original buffer.

Is there something threading here? If this is all threaded (at least from the point of view of this "server" code ... for a thread selection and to write results), you do not actually need fifa because things will be in your order. . If customers have a thread (or multiple ones) to vote, and there is a different thread to write the results, then FIFO is a great way to organize a thread communication.


Comments

Popular posts from this blog

sql - dynamically varied number of conditions in the 'where' statement using LINQ -

asp.net mvc - Dynamically Generated Ajax.BeginForm -

Debug on symbian -