Skip to content

High performance lock free queue in offheap, like disruptor

Notifications You must be signed in to change notification settings

rfyiamcool/fastq

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

fastq

High performance lock-free queue in offheap

Usage

package main

import (
	"fmt"

	"github.com/rfyiamcool/fastq"
)

func main() {
	fastq.Init()
	msg := &fastq.Message{
		Module:     "xiaorui.cc",
		Msg:        "i love u",
		RetryTimes: 1,
	}

	var count = 100
	for index := 0; index < count; index++ {
		err := fastq.Write(msg)
		fmt.Println(err)
	}

	for index := 0; index < count; index++ {
		module, message, err := fastq.Read()
		fmt.Println(index, module, message)
		if module != msg.Module {
			panic("err")
		}

		if message != msg.Msg {
			panic("err")
		}

		if err != nil {
			panic(err.Error())
		}
	}
}

About

High performance lock free queue in offheap, like disruptor

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages