On 28Aug2014 12:02, Marko Rauhamaa wrote:
Ervin Hegedüs :
at this time there is only one thread, as you wrote. I just try
to prepare it to higher load, when one thread will not enough...
Threads are a necessary evil when dealing with blocking function calls,
but evil they remain. [...snip...]
On Thu, Aug 28, 2014 at 1:35 PM, Ervin Hegedüs wrote:
> On Thu, Aug 28, 2014 at 12:34:18PM -0700, Chris Kaynor wrote:
depending on what you are doing with the first two arguments to self._exit,
>> the following might also work:
>>
>> def run(self):
>> try:
>> connect_to_db()
>>
Hi Chris,
On Thu, Aug 28, 2014 at 12:34:18PM -0700, Chris Kaynor wrote:
> On Thu, Aug 28, 2014 at 11:39 AM, Ervin Hegedüs wrote:
> >
> > now the code looks like this:
> >
> > def run(self):
> > try:
> > connect_to_db()
> > except:
> > self._exit(-1, "Connection error", sys.e
On Thu, Aug 28, 2014 at 11:39 AM, Ervin Hegedüs wrote:
> Hi Chris,
>
> thanks for you answer,
>
> On Thu, Aug 28, 2014 at 09:23:24AM -0700, Chris Kaynor wrote:
> > On Thu, Aug 28, 2014 at 1:52 AM, Ervin Hegedüs
> wrote:
> > >
> > > > In your case, you may want to just handle the exceptions insi
Hi Chris,
thanks for you answer,
On Thu, Aug 28, 2014 at 09:23:24AM -0700, Chris Kaynor wrote:
> On Thu, Aug 28, 2014 at 1:52 AM, Ervin Hegedüs wrote:
> >
> > > In your case, you may want to just handle the exceptions inside the
> > > thread's run() function directly. If that is not possible an
On Fri, Aug 29, 2014 at 2:23 AM, Chris Kaynor wrote:
> If what you want is to make sure the error is not printed to stderr, you'll
> just need to make sure the thread's run function does not exit with an
> exception. The simpliest way to do that would be to wrap the entire thread's
> run function
On Thu, Aug 28, 2014 at 1:52 AM, Ervin Hegedüs wrote:
>
> > In your case, you may want to just handle the exceptions inside the
> > thread's run() function directly. If that is not possible and you really
> > need to handle them inside the main thread, you would need to store off
> the
> > error
On Wed, Aug 27, 2014 at 1:55 PM, Ervin Hegedüs wrote:
> what's the correct way to terminate a thread by itself?
If this is something you need to do as a regular course of business, I'd
share a Queue between the main thread and the target thread. When you want
it to exit, shoot it a command to d
Hi Marko,
On Thu, Aug 28, 2014 at 12:02:29PM +0300, Marko Rauhamaa wrote:
> Ervin Hegedüs :
>
> > at this time there is only one thread, as you wrote. I just try
> > to prepare it to higher load, when one thread will not enough...
>
> Threads are a necessary evil when dealing with blocking funct
Ervin Hegedüs :
> at this time there is only one thread, as you wrote. I just try
> to prepare it to higher load, when one thread will not enough...
Threads are a necessary evil when dealing with blocking function calls,
but evil they remain. I would generally *not* associate a thread for
each pa
Hi Chris,
thanks for the reply,
On Wed, Aug 27, 2014 at 12:26:48PM -0700, Chris Kaynor wrote:
> On Wed, Aug 27, 2014 at 11:55 AM, Ervin Hegedüs wrote:
>
> > what's the correct way to terminate a thread by itself?
> >
>
> To terminate the thread, the run function must exit. This can be either
>
On Wed, Aug 27, 2014 at 11:55 AM, Ervin Hegedüs wrote:
> what's the correct way to terminate a thread by itself?
>
To terminate the thread, the run function must exit. This can be either
from an exception or a return statement.
>
> I mean:
>
> class MyThread(threading.Thread):
> def __init
Hi,
what's the correct way to terminate a thread by itself?
I mean:
class MyThread(threading.Thread):
def __init__(self, queueitem):
threading.Thread.__init__(self)
...
def run(self):
"""pseudo code below"""
try:
self.connect_to_database()
13 matches
Mail list logo