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.
FWIW, mkfifo isn’t the same on GNU/Linux and Windows- native.
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
Both “Git for Windows” and SUA (32 bit) mkfifo files would be PE32 executables, the latter functioning more like its UNIX antecedent.
SUA was deprecated circa Windows 8.0.
I presume the current “Git for Windows” includes the utility mkfifo.
I encountered problems installing SUA 64 bit on Windows 7 Ultimate.
Not much C# code on the log.
I have not used the VS2017 “Git for Windows” installer, but perhaps the Visual Studio Community Forum might be familiar with Windows-native mkfifo.
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.