> 
> All of the accesses to the request object are read operations.  If
> those read operations occur on data that does not get messed with by
> the main thread, then this should be thread-safe code.  However, it
> seems that the official word is "do not use request objects from other
> threads."  Maybe I am mistaken.  In any case, is there a safe way to
> get at request headers and parameter values outside of the reactor
> loop.

The rule is not to call any twisted functions IIRC.

You can do this safely:

   args_copy = dict(request.args)
   hdr_copy = dict(request.requestHeaders.getAllRawHeaders())
   deferToThread(func, args_copy, hdr_copy)

_______________________________________________
Twisted-Python mailing list
Twisted-Python@twistedmatrix.com
http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python

Reply via email to