My advice would be do not mess with the internals. I cannot tell myself 
what is does because depends on many circumstances. You have connection 
pools for examples and DAL can act as singleton in some cases.

If you want to use db in multiple threads, just make sure the function that 
creates the DAL instance does not return until the thread that uses it has 
joined.

On Thursday, 12 May 2016 12:02:05 UTC-5, Alfonso Serra wrote:
>
> I kinda have it but its very bad. i have to declare the connection as:
>
> class customthread(Thread):
>    def __init__
>       ....
>       self.db = DAL(cnnstring, migrate=False)
>       self.db['dontclose'] = True
>
>
> At gluon/packages/pydal/connection.py wich handles the ConnectionPool 
> modify the line 56 as:
>
> def close_all_instances(action):
>     ...
>      if hasattr(db, '_adapter') and not hasattr(db, "dontclose"):
>          db._adapter.close(action)
>
> I wish there were an easier way, and i dont really know the implications 
> of doing this. Ill tests it and see how it goes...
>
> Thanks
>
>
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to