Hi All,
I want to use therads in my application. Going through the docs , I read
about GIL.
Now I am confused whether using threads in python is safe or not.

One thing I know that if I am accessing global variables in two or more
threads I need to synchronize them
using locking or such mechanism so that only one thread access them at a
time.

below are few questions for which I am looking answers.

1.  In order to support multi-threaded Python programs, there's a global
lock that must be held
by the current thread before it can safely access Python objects.
Does this lock need to be held by python application script expliciltly
before accessing any python object or
interpreter takes acre of it ?

2. Does multithreaded python script need to held lock before calling any
blocking I/O call?
Or one should not worry about GIL while using python threads if job to be
processed by thread does not call
any global variables and thread unsafe Python/C extension ?

3. I. want to use threadpool mechanism in python. Would it not help in
multiprocessor environment if
job to be processed by worker thread is I/O bound ?

Sorry there are many questions here , but mostly they are related and are
because I am confused with GIL funda.

-- 
Thanx & Regards,
Deepak Rokade

Do what u Enjoy &
               Enjoy what u Do...........
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to