Hello,

>> async.submit_work(func, args, kwds, callback=None, errback=None)
>>
>> How do you implement arguments passing and return value?
>>
>> e.g. let's say I pass a list as argument: how do you iterate on the
>> list from the worker thread without modifying the backing objects for
>> refcounts (IIUC you use a per-thread heap and don't do any
>> refcounting).
>
>     Correct, nothing special is done for the arguments (apart from
>     incref'ing them in the main thread before kicking off the parallel
>     thread (then decref'ing them in the main thread once we're sure the
>     parallel thread has finished)).

IIUC you incref the argument from the main thread before publishing it
to the worker thread: but what about containers like list? How do you
make sure the refcounts of the elements don't get deallocated while
the worker thread iterates? More generally, how do you deal with
non-local objects?

BTW I don't know if you did, but you could probably have a look at
Go's goroutines and Erlang processes.

cf
_______________________________________________
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com

Reply via email to