All Projects → damnever → goqueue

damnever / goqueue

Licence: other
See https://github.com/damnever/goctl

Programming Languages

go
31211 projects - #10 most used programming language
Makefile
30231 projects

Projects that are alternatives of or similar to goqueue

jrsmq
A lightweight message queue for Java that requires no dedicated queue server. Just a Redis server.
Stars: ✭ 28 (-41.67%)
Mutual labels:  queue
Data-Structures-and-Algorithms
Implementation of various Data Structures and algorithms - Linked List, Stacks, Queues, Binary Search Tree, AVL tree,Red Black Trees, Trie, Graph Algorithms, Sorting Algorithms, Greedy Algorithms, Dynamic Programming, Segment Trees etc.
Stars: ✭ 144 (+200%)
Mutual labels:  queue
Tesseract
A set of libraries for rapidly developing Pipeline driven micro/macroservices.
Stars: ✭ 20 (-58.33%)
Mutual labels:  queue
turnio
🤖 Bot to manage a queue of slack users in a channel
Stars: ✭ 11 (-77.08%)
Mutual labels:  queue
queue-promise
A simple, dependency-free library for concurrent promise-based queues. Comes with with concurrency and timeout control.
Stars: ✭ 56 (+16.67%)
Mutual labels:  queue
queue
A queue-interop compatible Queueing library
Stars: ✭ 25 (-47.92%)
Mutual labels:  queue
queueable
Convert streams to async ⌛ iterables ➰
Stars: ✭ 43 (-10.42%)
Mutual labels:  queue
Data-structures
Data Structures in Java
Stars: ✭ 13 (-72.92%)
Mutual labels:  queue
mongo
Light-weight utilities and declarative schema (mutable mapping) to augment, not replace the Python MongoDB driver.
Stars: ✭ 18 (-62.5%)
Mutual labels:  queue
rust-sidekiq
Rust Sidekiq Client
Stars: ✭ 24 (-50%)
Mutual labels:  queue
ArduinoQueue
A lightweight linked list type queue implementation, meant for microcontrollers.
Stars: ✭ 29 (-39.58%)
Mutual labels:  queue
DSA
Data Structures and Algorithms
Stars: ✭ 13 (-72.92%)
Mutual labels:  queue
getui
Getui sdk package for laravel.
Stars: ✭ 19 (-60.42%)
Mutual labels:  queue
golib
Open version of common golang libraries useful to many projects.
Stars: ✭ 47 (-2.08%)
Mutual labels:  queue
elixir-queue
Queue data structure for Elixir-lang
Stars: ✭ 18 (-62.5%)
Mutual labels:  queue
php-rsmq
PHP implementation of Redis Simple Message Queue
Stars: ✭ 22 (-54.17%)
Mutual labels:  queue
celery.node
Celery task queue client/worker for nodejs
Stars: ✭ 164 (+241.67%)
Mutual labels:  queue
yii2-queuemanager
Yii2 Queue Manager (Analytic & Monitor)
Stars: ✭ 18 (-62.5%)
Mutual labels:  queue
Data-Structures-and-Algorithms
Data Structures and Algorithms implementation in Python
Stars: ✭ 31 (-35.42%)
Mutual labels:  queue
linda
Linda is a simple dispatcher library.
Stars: ✭ 12 (-75%)
Mutual labels:  queue

A GoRoutine safe queue for Golang Build Status GoDoc

It is similar to the Queue of Python.

Installation

go get github.com/damnever/goqueue

Example

Just for example, I use Queue.Get(0) and Queue.PutNoWait(value) more and often, but channel is not a right way do that...

package main

import (
    "fmt"
    "sync"

    "github.com/Damnever/goqueue"
)

func main() {
    queue := goqueue.New(0)
    wg := &sync.WaitGroup{}

    worker := func(queue *goqueue.Queue) {
        defer wg.Done()
        for !queue.IsEmpty() {
            val, err := queue.Get(0)
            if err != nil {
                fmt.Println("Unexpect Error: %v\n", err)
            }
            num := val.(int)
            fmt.Printf("-> %v\n", num)
            if num%3 == 0 {
                for i := num + 1; i < num+3; i++ {
                    queue.PutNoWait(i)
                }
            }
        }
    }

    go func() {
        defer wg.Done()
        for i := 0; i <= 27; i += 3 {
            queue.PutNoWait(i)
        }
    }()

    for i := 0; i < 5; i++ {
        go worker(queue)
    }

    wg.Add(6)
    wg.Wait()

    fmt.Println("All task done!!!")
}
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].