All Projects → paulmelnikow → SimpleObjectPool

paulmelnikow / SimpleObjectPool

Licence: Apache-2.0 license
Simple thread-safe object pool in Objective-C

Programming Languages

objective c
16641 projects - #2 most used programming language
ruby
36898 projects - #4 most used programming language

Projects that are alternatives of or similar to SimpleObjectPool

dotnet-design-patterns-samples
The samples of .NET design patterns
Stars: ✭ 25 (+92.31%)
Mutual labels:  factory, pool
node-redis-connection-pool
A node.js connection manager for Redis
Stars: ✭ 52 (+300%)
Mutual labels:  pool
typeorm-factory
Typeorm factory that makes testing easier
Stars: ✭ 28 (+115.38%)
Mutual labels:  factory
xdagj
XDAGJ is an implementation of XDAG in Java. https://xdag.io
Stars: ✭ 81 (+523.08%)
Mutual labels:  pool
factoria
Simplistic model factory for Node/JavaScript
Stars: ✭ 49 (+276.92%)
Mutual labels:  factory
billiards
billiards physics
Stars: ✭ 37 (+184.62%)
Mutual labels:  pool
angular-github-api-factory
AngularJS Factory for GitHub v3 JSON REST API requests
Stars: ✭ 13 (+0%)
Mutual labels:  factory
gohive
🐝 A Highly Performant and easy to use goroutine pool for Go
Stars: ✭ 41 (+215.38%)
Mutual labels:  pool
ViewControllersFactory
Instantiate your ViewControllers easily with this small factory class
Stars: ✭ 26 (+100%)
Mutual labels:  factory
SteroidsDI
Advanced Dependency Injection to use every day.
Stars: ✭ 15 (+15.38%)
Mutual labels:  factory
pool
A generic C memory pool
Stars: ✭ 81 (+523.08%)
Mutual labels:  pool
UA-IIoT-StarterKit
Samples and tutorials to illustrate how to build OPC UA PubSub applications.
Stars: ✭ 55 (+323.08%)
Mutual labels:  factory
node-screenlogic
Pentair ScreenLogic Javascript library using Node.JS
Stars: ✭ 38 (+192.31%)
Mutual labels:  pool
faker
Random fake data and struct generator for Go.
Stars: ✭ 67 (+415.38%)
Mutual labels:  factory
pool
Go library that wraps http.Client to provide seamless higher-level connection pooling features
Stars: ✭ 39 (+200%)
Mutual labels:  pool
angular-youtube-api-factory
AngularJS Factory for Youtube JSON REST API requests
Stars: ✭ 21 (+61.54%)
Mutual labels:  factory
parallelizer
Simplifies the parallelization of function calls.
Stars: ✭ 62 (+376.92%)
Mutual labels:  pool
mysql-connection-pool-manager
This is a mySQL Connection Pool Manager wrapper powered by mysqljs/mysql and allows for intelligent management & load balancing mysql connection pools.
Stars: ✭ 15 (+15.38%)
Mutual labels:  pool
ethersocial-pool
Open EthersocialNetwork Mining Pool based off the sammy007's open-ethereum-pool
Stars: ✭ 19 (+46.15%)
Mutual labels:  pool
mimesis-factory
Mimesis integration with factory_boy
Stars: ✭ 42 (+223.08%)
Mutual labels:  factory

SimpleObjectPool

Simple implementation of a thread-safe object pool.

Version License Platform Build

Pool

Usage

When the pool is empty, it naively creates another object using the createBlock.

ObjectPool *pool = [ObjectPool poolWithCreateBlock:^id(NSError **outError) {
    NSLog(@"Opening database connection");
    MyDBConnection *connection = [MyDBConnection connection]
    if (![connection openWithError:outError])
	    return nil;
    else
 	    return connection;
}];

MyDBConnection *connection = [pool objectFromPoolWithError:nil];

// do stuff with connection

[pool returnObjectToPool:connection];

Installation

Install via CocoaPods.

Contribute

Pull requests welcome!

Support

If you are having issues, please let me know.

Development

This project includes unit tests. To run them, run pod install inside the TestProject folder, then load the workspace and execute the test action.

License

This project is licensed under the Apache license.

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