Skip to content

Instantly share code, notes, and snippets.

View myaser's full-sized avatar
🧠
What I cannot create, I do not understand

Mahmoud Yaser myaser

🧠
What I cannot create, I do not understand
  • Berlin, Germany
View GitHub Profile
@fordguo
fordguo / pool.py
Created August 26, 2011 02:31
A simple python object pool with thread safe
#-*- coding:utf-8 -*-
import Queue
from contextlib import contextmanager
class ObjectPool(object):
"""A simple object pool with thread safe"""
def __init__(self,objectFn,*args,**kwargs):
super(ObjectPool, self).__init__()
self.objectFn = objectFn
self.objectCls = None