#std.io.queue.init question

1 messages · Page 1 of 1 (latest)

sage spoke
#

the init function requires a buffer as a parameter, what happens if i give an empty one?
i just need a regular queue, im not going to interact with files or networking.

#

from what i understand, std.io interface, when passing in an empty buffer, that tells the interface to immediately flush any written data. but what does that mean for a queue? does it hold off on putting the items into the actual queue data structure until the buffer is full?

#

if it helps, what i want is a FIFO structure. i don't care if its singlethreaded only

sage spoke
#

Okay, looks like it's not a good idea to use this type of queue for my purposes

#

it blocks if there's enough enough space and waits until space is remaining.

#

Guess i'll just make my own primitive FIFO structure until there's one in the std

plucky plaza
#

you can just use an ArrayList for your purposes.
std.Io.Queue is for sending things across async tasks or 'threads'.
if you give it a zero sized buffer it will not have any space to put data, so when you try it will block until some other task/thread reads from it, effectively using the stacks in place of the buffer.