(this is a repost with an addition - probably noone noticed my message first
time)
Hi!
Just to be sure, is email package of Python 2.3 thread-safe or not
(to use, for example, in python-milter?)
P.S. And where can I find information on particular piece of standard library
if it is thread-safe or need locking? I recall 'random' module is (was?)
unsafe - which isexplicitly stated in the docs. Can I assume that everything
else without such notice is thread-safe?
Sincerely yours,
Roman A.Souzi
-- http://mail.python.org/mailman/listinfo/python-list 5 1874
Usually, oo-style apis are thread-safe as long as each thread uses its own
objects. Shared global state is _very_ uncommon, and if it's most probably
documented.
--
Regards,
Diez B. Roggisch
Op 2005-02-09, Roman Suzi schreef <rn*@onego.ru >: (this is a repost with an addition - probably noone noticed my message first time)
Hi!
Just to be sure, is email package of Python 2.3 thread-safe or not (to use, for example, in python-milter?)
P.S. And where can I find information on particular piece of standard library if it is thread-safe or need locking? I recall 'random' module is (was?) unsafe - which isexplicitly stated in the docs.
Well I guess it was unsafe. The current documentation states:
The underlying implementation in C is both fast and threadsafe. http://www.python.org/doc/2.3.5/lib/module-random.html
There is class for random number generation that is not thread safe
and is included to allow reproducing sequences from previous versions.
Can I assume that everything else without such notice is thread-safe?
I doubt it. There is no indication that the email package uses any
kind of locking. So multiple thread working on the same message
will probably screw things up.
--
Antoon Pardon
On Wed, 9 Feb 2005, Antoon Pardon wrote: Op 2005-02-09, Roman Suzi schreef <rn*@onego.ru >: Just to be sure, is email package of Python 2.3 thread-safe or not (to use, for example, in python-milter?)
Can I assume that everything else without such notice is thread-safe?
I doubt it. There is no indication that the email package uses any kind of locking. So multiple thread working on the same message will probably screw things up.
Of course, I do not let threads to work on the same message!
I meant that the package doesn't pose other kinds of restrictions.
Can it work in _any_ situation work on two different messages at the same
time, without any interference?
Sincerely yours, Roman Suzi
-- rn*@onego.ru =\= My AI powered by GNU/Linux RedHat 7.3
Op 2005-02-09, Roman Suzi schreef <rn*@onego.ru >: On Wed, 9 Feb 2005, Antoon Pardon wrote:
Op 2005-02-09, Roman Suzi schreef <rn*@onego.ru >: Just to be sure, is email package of Python 2.3 thread-safe or not (to use, for example, in python-milter?) Can I assume that everything else without such notice is thread-safe? I doubt it. There is no indication that the email package uses any kind of locking. So multiple thread working on the same message will probably screw things up.
Of course, I do not let threads to work on the same message!
Why should that be: "off course"? The random module you spoke about
was also only thread unsafe if you called the same random generator
from various threads. Using a randon generator per thread shouldn't
have been a problem. Since you mentioned that, I thought that was
the kind of thread safety you were after.
I meant that the package doesn't pose other kinds of restrictions. Can it work in _any_ situation work on two different messages at the same time, without any interference?
I can't give a guarantee, but there are no global statements and there
doesn't seem to be assignments to cross module variables I think it
would be a safe bet.
--
Antoon Pardon
On Thu, 10 Feb 2005, Antoon Pardon wrote: Op 2005-02-09, Roman Suzi schreef <rn*@onego.ru >: On Wed, 9 Feb 2005, Antoon Pardon wrote:
Op 2005-02-09, Roman Suzi schreef <rn*@onego.ru >:
Just to be sure, is email package of Python 2.3 thread-safe or not (to use, for example, in python-milter?)
Can I assume that everything else without such notice is thread-safe?
I doubt it. There is no indication that the email package uses any kind of locking. So multiple thread working on the same message will probably screw things up.
Of course, I do not let threads to work on the same message!
Why should that be: "off course"? The random module you spoke about was also only thread unsafe if you called the same random generator from various threads. Using a randon generator per thread shouldn't have been a problem. Since you mentioned that, I thought that was the kind of thread safety you were after.
I meant that the package doesn't pose other kinds of restrictions. Can it work in _any_ situation work on two different messages at the same time, without any interference?
I can't give a guarantee, but there are no global statements and there doesn't seem to be assignments to cross module variables I think it would be a safe bet.
Thanks to all who discussed this. Really, I had the same thoughts about
1:1 object-thread relation being thread safe. I am doing further research and
if it will give interesting results, I shall post [solved] here.
Sincerely yours, Roman Suzi
-- rn*@onego.ru =\= My AI powered by GNU/Linux RedHat 7.3 This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Roman Suzi |
last post by:
Hi!
Just to be sure, is email package of Python 2.3 thread-safe or not
(to use, for example, in python-milter?)
Sincerely yours,
Roman A.Souzi
|
by: Steevo |
last post by:
Any suggestions as to the best programs for cloaking email addresses?
Many thanks
--
Steevo
|
by: aurora00 |
last post by:
Looking at the email package, it seems all the MIMExxx classes takes
string but not file object as the payload. I need to handle very large
MIME messages say up to 100M. And possibly many of them. Is email
package sufficient. If not is it possible to extend it?
Looking at a previous thread it seems the standard library is not
sufficient.
...
|
by: Jonathan Burd |
last post by:
Greetings everyone,
Here is a random string generator I wrote for an application
and I'm wondering about the thread-safety of this function.
I was told using static and global variables cause
potential problems for thread-safety. So far, I'm only confused.
I need a proper explanation for the concept so I can understand how
to write thread-safe functions in the future.
My apologies for posting a long routine.
|
by: dwight0 |
last post by:
I have a DTS package that can be execute from ASP.net and I was
wondering if there is a way to make this thread safe some how. I know
thread safe isn't exactly the word I'm looking for but let me know
what the correct term is. What I have is an asp.net page that executes
a DTS package and I want to be sure no two people will click a submit
button on this page from 2 different computers at the same time. And if
they do I want one to be...
| |
by: Laser Lu |
last post by:
I was often noted by Thread Safety declarations when I was reading .NET Framework Class Library documents in MSDN.
The declaration is usually described as 'Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.'
So, does this mean All the static/shared methods written in .NET compatible programming language, such as C#, VB.NET, are guaranteed to be...
|
by: jecheney |
last post by:
Hi,
Im currently using the following code for reading/writing to a network
socket.
private StreamReader clientStreamReader;
private StreamWriter clientStreamWriter;
....
TcpClient tcpClient = new
TcpClient(server_host_name, server_port);
|
by: arun.darra |
last post by:
Are the following thread safe:
1. Assuming Object is any simple object
Object* fn()
{
Object *p = new Object();
return p;
}
2. is return by value thread safe?
|
by: Laszlo Nagy |
last post by:
Hi All,
'm in trouble with decoding email subjects. Here are some examples:
I know that "=?UTF-8?B" means UTF-8 + base64 encoding, but I wonder if
there is a standard method in the "email" package to decode these
subjects? I do not want to re-invent the weel.
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
| |
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |