Skip to content

phluid61/threadpuddle-gem

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ThreadPuddle

Like a smaller, lamer thread pool.


Public Class Methods

ThreadPuddle.new(capacity)

Creates a new ThreadPuddle object, with a fixed capacity.

Public Instance Methods

tp.capacity → int

Retrieves the ThreadPuddle object's capacity.

tp.size → int

Number of threads currently occupying the puddle.

tp.blocktp

Blocks execution of the calling thread until there's a free slot in the puddle.

WARNING: there is no guarantee this will ever return.

tp.spawn(*args) {|*args| ... } → Thread

Spawns a new thread in the puddle.

If the puddle is full, this call blocks.

 @yields *args
 @see ThreadPuddle#block
 @return the new Thread object

tp.jointp

Waits for all threads in the puddle to join.

 @return this ThreadPuddle object

tp.kill → int

Kills all threads in the puddle.

 @return the number of threads killed

Build Status

About

Like a smaller, lamer thread pool.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages