MCPcopy
hub / github.com/django/django / thread_func

Method thread_func

tests/test_utils/tests.py:2329–2341  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

2327 connections_dict = {}
2328
2329 def thread_func():
2330 # Passing django.db.connection between threads doesn't work while
2331 # connections[DEFAULT_DB_ALIAS] does.
2332 from django.db import connections
2333
2334 connection = connections["default"]
2335
2336 next(Car.objects.iterator(), None)
2337
2338 # Allow thread sharing so the connection can be closed by the main
2339 # thread.
2340 connection.inc_thread_sharing()
2341 connections_dict[id(connection)] = connection
2342
2343 try:
2344 t = threading.Thread(target=thread_func)

Callers

nothing calls this directly

Calls 2

inc_thread_sharingMethod · 0.80
iteratorMethod · 0.45

Tested by

no test coverage detected