C++/CLI FIFO - Lista vs. Array para lectura serialPort

I have quite silly basic question. But i think that it could be very useful for many other junior programmers.

I am communicating quite fast(12Mb/s) via serialPort (receiving) and I want to make a FIFO buffer for String^s, which I will extract from incoming messages(start bytes - message with details - stop bytes). What would you recommend me?

A) Should I use solid buffer based on Array class?

B) Should I use dynamic buffer based on List class?

Muchas gracias.

PS: I also have to mention, that data collection to this array runs in one thread. Second thread decode string from this buffer and third thread manages both threads.

preguntado el 31 de julio de 12 a las 13:07

Ok. So far I am browsing List class, it looks that List is better, but I am not sure about speed of this Class. -

A Queue<String^>^ is appropriate here. Don't forget to lock to make it thread-safe. ConcurrentQueue if you target .NET 4. -

That seems like answer. So if you want to answer it, make it as answer or I answer it myself tomorrow. Thanks. -

1 Respuestas

as Hans has written, the best solution of my problem is class Queue, with all hardness connected with it.

Respondido 01 ago 12, 07:08

No es la respuesta que estás buscando? Examinar otras preguntas etiquetadas or haz tu propia pregunta.