All Projects → OnlyTerminator → GeekThread

OnlyTerminator / GeekThread

Licence: other
Android ThreadPool的封装

Programming Languages

java
68154 projects - #9 most used programming language

Projects that are alternatives of or similar to GeekThread

cpp-thread-study
C++ 线程库示例及教程
Stars: ✭ 38 (-60.82%)
Mutual labels:  thread
matrix multiplication
Parallel Matrix Multiplication Using OpenMP, Phtreads, and MPI
Stars: ✭ 41 (-57.73%)
Mutual labels:  thread
go-worker-thread-pool
A visual working example of a Thread Pool pattern, based on a known blog article.
Stars: ✭ 24 (-75.26%)
Mutual labels:  thread
RxSchedulerSuppress
RxSchedulerSuppress 是用于抑制 RxJava 在同一个线程池内重复调度的工具
Stars: ✭ 30 (-69.07%)
Mutual labels:  thread
spinach
Modern Redis task queue for Python 3
Stars: ✭ 46 (-52.58%)
Mutual labels:  thread
mulle-thread
🔠 Cross-platform thread/mutex/tss/atomic operations in C
Stars: ✭ 22 (-77.32%)
Mutual labels:  thread
java-tutorial
Java 实践代码,多线程,数据结构,算法,设计模式,Spring,RabbitMQ ,RocketMQ
Stars: ✭ 15 (-84.54%)
Mutual labels:  thread
theater
Actor framework for Dart. This package makes it easier to work with isolates, create clusters of isolates.
Stars: ✭ 29 (-70.1%)
Mutual labels:  thread
mcfgthread
Cornerstone of the MOST efficient std::thread on Windows for mingw-w64
Stars: ✭ 143 (+47.42%)
Mutual labels:  thread
ObviousAwait
🧵 Expressive aliases to ConfigureAwait(true) and ConfigureAwait(false)
Stars: ✭ 55 (-43.3%)
Mutual labels:  thread
Adun
A way to backdoor every process
Stars: ✭ 58 (-40.21%)
Mutual labels:  thread
thread-priority
A simple thread schedule and priority library for rust
Stars: ✭ 48 (-50.52%)
Mutual labels:  thread
haxe-concurrent
A haxelib for basic platform-agnostic concurrency support
Stars: ✭ 69 (-28.87%)
Mutual labels:  thread
betterdocs
📚 Web version of https://github.com/khusnetdinov/ruby.fundamental repo - Fundamental programming with ruby examples and references. It covers threads, SOLID principles, design patterns, data structures, algorithms. Books for reading.
Stars: ✭ 25 (-74.23%)
Mutual labels:  thread
HiFramework.Unity
Based on component to manage project's core logic and module used in unity3d
Stars: ✭ 22 (-77.32%)
Mutual labels:  thread
ComposableAsync
Create, compose and inject asynchronous behaviors in .Net Framework and .Net Core.
Stars: ✭ 28 (-71.13%)
Mutual labels:  thread
AsyncKeepAlive
AsyncKeepAlive is a plugin that keep the players' connections alive
Stars: ✭ 13 (-86.6%)
Mutual labels:  thread
uniq
A lock-free (multi reader / multi writer) circular buffered queue.
Stars: ✭ 32 (-67.01%)
Mutual labels:  thread
isolate handler
Effortless isolates abstraction layer with support for MethodChannel calls.
Stars: ✭ 29 (-70.1%)
Mutual labels:  thread
gls
goroutine local storage (use context instead if possible)
Stars: ✭ 52 (-46.39%)
Mutual labels:  thread

GeekThread

Android ThreadPool的封装

使用方法

在项目的build.gradle里面加上引用:

compile 'com.geek.thread:thread-pool:1.0.1'

方法说明

GeekThreadManager.getInstance().execute(new GeekRunnable(ThreadPriority.LOW) {
    @Override
    public void run() {
        // do something
    }
}, ThreadType.NORMAL_THREAD);

通过传入Runable的方式来使用多线程,其中ThreadPriority.LOW表示线程级别,ThreadType.NORMAL_THREAD表示线程类型。

GeekThreadManager.getInstance().execute(new GeekThread(ThreadPriority.NORMAL) {
    @Override
    public void run() {
        super.run();
          // do something
    }
},ThreadType.NORMAL_THREAD);

这个使用方法与上面的类似,只是传入的Runable换成了Thread

GeekThreadPools.executeWithGeekThreadPool(new Runnable() {
    @Override
    public void run() {
        //do something
    }
});

直接扔进去一个普通的Runable,线程级别和类型都为普通的。

总结

这个框架主要的作用是内部帮我们实现了线程池,维护了多线程,我们只需要在使用的地方调用就可以了,无需担心因为多出调用多线程而导致的内存消耗等问题,也不需要每次都去实现一个线程池。

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].