diff --git a/README.md b/README.md index 59aa035..f7a93fe 100644 --- a/README.md +++ b/README.md @@ -12,13 +12,14 @@ [中文](README_ZH.md) | [Project Tutorial](http://blog.taohuawu.club/article/goroutine-pool) -Package `ants` implements a fixed goroutine pool for managing and recycling a massive number of goroutines, allowing developers to limit the number of goroutines that created in your concurrent programs. +Library `ants` implements a fixed capacity goroutine-pool for managing and recycling a massive number of goroutines, allowing developers to limit the number of goroutines that created in your concurrent programs. ## Features: - Automatically managing and recycling a massive number of goroutines. -- Periodically clearing overdue goroutines. +- Periodically purging overdue goroutines. - Friendly interfaces: submitting tasks, getting the number of running goroutines, readjusting capacity of pool dynamically, closing pool. +- Handle panic gracefully to prevent programs from crash. - Efficient in memory usage and it even achieves higher performance than unlimited goroutines in golang. @@ -35,7 +36,7 @@ glide get github.com/panjf2000/ants ``` ## How to use -If your program will generate a massive number of goroutines and you don't want them to consume a vast amount of memory, with `ants`, all you need to do is to import `ants` package and submit all your tasks to the default limited pool created when `ants` was imported: +Just take a imagination that your program startovers a massive number of goroutines, from which a vast amount of memory will be consumed. To mitigate that kind of thing, all you need to do is to import `ants` package and submit all your tasks to a default pool with fixed capacity created when `ants` has been imported: ``` go package main @@ -160,7 +161,7 @@ ants.Submit(func(){}) ``` ## Customize limited pool -`ants` also supports customizing limited pool. You can use the `NewPool` method to create a pool with the given capacity, as following: +`ants` also supports customizing the capacity of pool. You can call the `NewPool` function to instantiate a pool with a given capacity, as following: ``` go // Set 10000 the size of goroutine pool @@ -170,17 +171,17 @@ p.Submit(func(){}) ``` ## Tune pool capacity -You can change `ants` pool capacity at any time with `ReSize(int)`: +You can tune the capacity of `ants` pool at any time with `ReSize(int)`: ``` go pool.ReSize(1000) // Tune its capacity to 1000 pool.ReSize(100000) // Tune its capacity to 100000 ``` -Don't worry about the synchronous problems in this case, this method is thread-safe. +Don't worry about the synchronous problems in this case, the function here is thread-safe (or should be called goroutine-safe). ## About sequence -All the tasks submitted to `ants` pool will not be guaranteed to be processed in order, because those tasks distribute among a series of concurrent workers, thus those tasks are processed concurrently. +All the tasks submitted to `ants` pool will not be guaranteed to be addressed in order, because those tasks scatter among a series of concurrent workers, thus those tasks are executed concurrently. ## Benchmarks @@ -194,27 +195,27 @@ Go1.9
