All Projects β†’ shettyh β†’ threadpool

shettyh / threadpool

Licence: Apache-2.0 License
Golang simple thread pool implementation

Programming Languages

go
31211 projects - #10 most used programming language

Projects that are alternatives of or similar to threadpool

asynqro
Futures and thread pool for C++ (with optional Qt support)
Stars: ✭ 103 (+51.47%)
Mutual labels:  future, threadpool
Beatserver
Beatserver, a periodic task scheduler for Django 🎡
Stars: ✭ 106 (+55.88%)
Mutual labels:  scheduler, channels
YACLib
Yet Another Concurrency Library
Stars: ✭ 193 (+183.82%)
Mutual labels:  scheduler, future
nodejs-cron-job-must-know
it is an example of running node.js script with every certain period(cron job)
Stars: ✭ 35 (-48.53%)
Mutual labels:  scheduler
asparagus
An easy to use task scheduler for distributed systems
Stars: ✭ 14 (-79.41%)
Mutual labels:  scheduler
Python-notes
Python related technologies used in work: crawler, data analysis, timing tasks, RPC, page parsing, decorator, built-in functions, Python objects, multi-threading, multi-process, asynchronous, redis, mongodb, mysql, openstack, etc.
Stars: ✭ 104 (+52.94%)
Mutual labels:  scheduler
spring-boot-scheduler-example
The project demonstrates how to schedule tasks with Spring Boot using the @scheduled annotation
Stars: ✭ 27 (-60.29%)
Mutual labels:  scheduler
networkdays
Networkdays functions ... including `networkdays` excel like function with no dependencies (no NumPy)
Stars: ✭ 22 (-67.65%)
Mutual labels:  scheduler
lifeline-rs
A dependency injection library for message-based applications
Stars: ✭ 32 (-52.94%)
Mutual labels:  channels
CoopThreads
Lightweight, platform agnostic, stackful cooperative threads library.
Stars: ✭ 18 (-73.53%)
Mutual labels:  scheduler
pink
εˆ†εΈƒεΌδ»»εŠ‘θ°ƒεΊ¦εΉ³ε°
Stars: ✭ 61 (-10.29%)
Mutual labels:  scheduler
swordfish
Open-source distribute workflow schedule tools, also support streaming task.
Stars: ✭ 35 (-48.53%)
Mutual labels:  scheduler
bitnami-docker-airflow-scheduler
Bitnami Docker Image for Apache Airflow Scheduler
Stars: ✭ 19 (-72.06%)
Mutual labels:  scheduler
scheduler
Task Scheduler for Laravel applications. UI from scratch
Stars: ✭ 18 (-73.53%)
Mutual labels:  scheduler
su-downloader3
nodejs HTTP downloader with pause/resume support and segmented downloading
Stars: ✭ 14 (-79.41%)
Mutual labels:  scheduler
Async-Channel
Python async multi-task communication library. Used by OctoBot project.
Stars: ✭ 13 (-80.88%)
Mutual labels:  channels
TNImageView-Android
Android Library for making scale-able and rotatable image views or giving this power to your own image view. This repo has been depreciated.
Stars: ✭ 18 (-73.53%)
Mutual labels:  scalable
wae
An async executor based on the Win32 thread pool API
Stars: ✭ 10 (-85.29%)
Mutual labels:  threadpool
scheduler-framework-sample
This repo is a sample for Kubernetes scheduler framework.
Stars: ✭ 35 (-48.53%)
Mutual labels:  scheduler
gt-scheduler
πŸ“† GT Scheduler
Stars: ✭ 58 (-14.71%)
Mutual labels:  scheduler

Golang Threadpool implementation

Build Status codecov GoDoc Go Report Card

Scalable threadpool implementation using Go to handle the huge network trafic.

Install

go get github.com/shettyh/threadpool

Usage

Threadpool

  • Implement Runnable interface for tha task that needs to be executed. For example

    type MyTask struct { }
     
    func (t *MyTask) Run(){
      // Do your task here
    }
     
    
  • Create instance of ThreadPool with number of workers required and the task queue size

    pool := threadpool.NewThreadPool(200,1000000)
    
  • Create Task and execute

    task:=&MyTask{}
    err := pool.Execute(task)
    
  • Using Callable task

    type MyTaskCallable struct { }
    
    func (c *MyTaskCallable) Call() interface{} {
      //Do task 
      return result
    }
    
    //Execute callable task
    task := &MyTaskCallable{}
    future, err := pool.ExecuteFuture(task)
    
    //Check if the task is done
    isDone := future.IsDone() // true/false
    
    //Get response , blocking call
    result := future.Get()
    
    
  • Close the pool

    pool.Close()
    

Scheduled threadpool

  • Create instance of ScheduledThreadPool with number of workers required
    schedulerPool:= threadpool.NewScheduledThreadPool(10)
    
  • Create Task and schedule
    task:=&MyTask{}
    pool.ScheduleOnce(task, time.Second*20) // Time delay is in seconds only as of now
    
  • Close the pool
    pool.Close()
    
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].