how to use FIFO in go
Do you mean the data structure or the system call mkfifo?
You would have to implement the queue data structure by yourself. The only data structures available by default are arrays, slices and structs.
You could implement FIFO using the doubly linked list:
Or adapt one like this:
Don’t forget channels. They are a type too.
Channels function as FIFO queues. To quote the Go Programming Language Specification,
Channels act as first-in-first-out queues. For example, if one goroutine sends values on a channel and a second goroutine receives them, the values are received in the order sent.
Depending on the application, a channel can be a very easy way to implement a FIFO.
mkfifo but It seems that there is no have mkfifo in windwos
thank you but i want use FIFO to Communication with C# program
thank you but i want use FIFO to Communication with C# program.now failed
yes you are right.but how to do it
If the programs are running at the same time could you use RPC to communicate between them. Something like this:
Or are the programs running at different times and the queue is written by one program and read by the other?
How many items in the queue? How big are they? Maybe if the queue isn’t made of massive amounts of data could you use temporary files which are sorted according to date and always read and then remove the oldest file.
Is a implementation of named pipes in go by microsoft.
Yes but it has not been updated for 4 years so maybe go-winio is a safer bet.
This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.