Re: threads and timeout -> running a shell command / want to guard against infinite loops

2013-02-10 Thread marcus . liddle
On Tuesday, 19 August 2003 15:01:01 UTC+12, Marcus Liddle wrote: > > > Hi > > I'm trying to get a really simple python program to > run a bash testing script and kill itself if its > been running to long (ie infinite loop) > > create the thread object - test = TestThread() > run the comman

Re: Threads and sockets

2012-08-13 Thread Ulrich Eckhardt
Am 10.08.2012 15:01, schrieb loial: I am writing an application to send data to a printer port(9100) and then recieve PJL responses back on that port. Because of the way PJL works I have to do both in the same process(script). If I understand that right, you are opening a TCP connection, so ob

Re: Threads and sockets

2012-08-10 Thread Grant Edwards
On 2012-08-10, loial wrote: > At the moment I do not start to read responses until the data has > been sent to the printer. However it seems I am missing some > responses from the printer whilst sending the data, so I need to be > able to do the 2 things at the same time. > > Can I open a port on

Re: Threads and sockets

2012-08-10 Thread Dan Stromberg
A select() loop should work. On Fri, Aug 10, 2012 at 1:01 PM, loial wrote: > I am writing an application to send data to a printer port(9100) and then > recieve PJL responses back on that port. Because of the way PJL works I > have to do both in the same process(script). > > At the moment I do n

Re: Threads and sockets

2012-08-10 Thread Dieter Maurer
loial writes: > I am writing an application to send data to a printer port(9100) and then > recieve PJL responses back on that port. Because of the way PJL works I have > to do both in the same process(script). > > At the moment I do not start to read responses until the data has been sent > t

Re: Threads vs subprocesses

2012-06-17 Thread Cameron Simpson
On 18Jun2012 00:17, John O'Hagan wrote: | On Sat, 16 Jun 2012 13:27:45 -0400 | Dennis Lee Bieber wrote: | > Not "after each event is read" but when a new event is | > generated/inserted. The list is not a FIFO where new events are added to | > the end, but more of a priority queue where the l

Re: Threads vs subprocesses

2012-06-17 Thread John O'Hagan
On Sat, 16 Jun 2012 13:27:45 -0400 Dennis Lee Bieber wrote: > On Sat, 16 Jun 2012 20:01:12 +1000, John O'Hagan > declaimed the following in > gmane.comp.python.general: > > > > > That looks like a possible way to do all the streams in a single thread, > > although it works a little differently

Re: Threads vs subprocesses

2012-06-16 Thread John O'Hagan
On Fri, 15 Jun 2012 16:34:57 -0400 Dennis Lee Bieber wrote: > On Sat, 16 Jun 2012 03:24:13 +1000, John O'Hagan > declaimed the following in > gmane.comp.python.general: > > > > I should have made it clear that I'm not using threads to speed anything up; > > each thread produces an independentl

RE: Threads vs subprocesses

2012-06-15 Thread Prasad, Ramit
> > > My question is, on a single core machine, what are the pros and cons of > > > threads vs subprocesses in a setup like this? > > > > [...] > > > > Two key phrases in your message; CPU-intensive, > > single-core-machine. If these have the conventional meaning, you're > > better off doing all

Re: Threads vs subprocesses

2012-06-15 Thread John O'Hagan
On Fri, 15 Jun 2012 11:51:01 -0400 Dave Angel wrote: > On 06/15/2012 09:49 AM, John O'Hagan wrote: > > I have a program in which the main thread launches a number of CPU-intensive > > worker threads. For each worker thread two python subprocesses are started, [...] > > > > So far so good, but it

Re: Threads vs subprocesses

2012-06-15 Thread Dave Angel
On 06/15/2012 09:49 AM, John O'Hagan wrote: > I have a program in which the main thread launches a number of CPU-intensive > worker threads. For each worker thread two python subprocesses are started, > each of which runs in its own terminal: one displays output received from the > worker thread vi

Re: Threads on google groups not on gmane?

2012-04-02 Thread Mark Lawrence
On 02/04/2012 12:23, Steven D'Aprano wrote: On Mon, 02 Apr 2012 03:16:26 -0700, Paul Rubin wrote: Robert Kern writes: I also don't see these on GMane. It's possible that they are getting caught in one of GMane's several levels of spam filtering. I'm seeing some weird issues where google gro

Re: Threads on google groups not on gmane?

2012-04-02 Thread Steven D'Aprano
On Mon, 02 Apr 2012 03:16:26 -0700, Paul Rubin wrote: > Robert Kern writes: >> I also don't see these on GMane. It's possible that they are getting >> caught in one of GMane's several levels of spam filtering. > > I'm seeing some weird issues where google groups posts on another > newsgroup aren

Re: Threads on google groups not on gmane?

2012-04-02 Thread Paul Rubin
Robert Kern writes: > I also don't see these on GMane. It's possible that they are getting > caught in one of GMane's several levels of spam filtering. I'm seeing some weird issues where google groups posts on another newsgroup aren't making it to the non-google nntp server that I use. The parano

Re: Threads on google groups not on gmane?

2012-04-02 Thread Robert Kern
On 3/31/12 1:47 AM, Mark Lawrence wrote: I went onto google groups to do a search and saw three threads (there may be more) that I've never seen on gmane, which I read via thunderbird on windows. The titles are "Is programming art or science", "breezypythongui: A New Toolkit for Easy GUIs in Pyth

Re: Threads on google groups not on gmane?

2012-04-01 Thread Anssi Saari
Mark Lawrence writes: > I went onto google groups to do a search and saw three threads (there > may be more) that I've never seen on gmane, which I read via > thunderbird on windows. The titles are "Is programming art or > science", "breezypythongui: A New Toolkit for Easy GUIs in Python" and >

Re: Threads in Python

2011-09-01 Thread Grant Edwards
On 2011-09-01, Stephen Hansen wrote: > On 9/1/11 2:45 PM, George Kovoor wrote: >> Why doesn't python threads show an associated PID? On spawning >> python threads using the threading module I can only see the main >> thread's pid on using top or ps unix command, no subprocesses are >> displayed.

Re: Threads in Python

2011-09-01 Thread Cameron Simpson
On 01Sep2011 15:27, Stephen Hansen wrote: | On 9/1/11 2:45 PM, George Kovoor wrote: | > Why doesn't python threads show an associated PID? On spawning python | > threads using the threading module I can only see the main thread's pid on | > using top or ps unix command, no subprocesses are displ

Re: Threads in Python

2011-09-01 Thread Stephen Hansen
On 9/1/11 2:45 PM, George Kovoor wrote: > Hi, > Why doesn't python threads show an associated PID? On spawning python > threads using the threading module I can only see the main thread's pid on > using top or ps unix command, no subprocesses are displayed. In otherwords > top or ps in not aware

Re: threads with gtk gui problem

2011-05-15 Thread Daniel Kluev
You can also use multiprocessing module instead of threads. Use pipe and gobject.idle_add(somefunc) to process data from other thread. -- With best regards, Daniel Kluev -- http://mail.python.org/mailman/listinfo/python-list

Re: threads with gtk gui problem

2011-05-14 Thread andy baxter
On 14/05/11 14:12, Andy Baxter wrote: Hi, I'm working on adding a Gtk GUI to a python program. Its main function is to read raw data from an arduino board over USB, and convert it to MIDI note/controller events to be sent to another program. I've had it working fine with just a command line i

Re: threads with gtk gui problem

2011-05-14 Thread andy baxter
On 14/05/11 14:12, Andy Baxter wrote: Hi, I'm working on adding a Gtk GUI to a python program. Its main function is to read raw data from an arduino board over USB, and convert it to MIDI note/controller events to be sent to another program. I've had it working fine with just a command line i

Re: threads (specifically timers) and releasing resources

2010-03-25 Thread Alex Hall
Thanks, this should work. On 3/25/10, Tim Golden wrote: > On 25/03/2010 02:31, Alex Hall wrote: >> Okay, I have my program and it has three different modes (there will >> be more than that). Each mode will have a timer attached to it. If the >> mode remains active and the timer runs out, a functi

Re: threads (specifically timers) and releasing resources

2010-03-25 Thread Tim Golden
On 25/03/2010 02:31, Alex Hall wrote: Okay, I have my program and it has three different modes (there will be more than that). Each mode will have a timer attached to it. If the mode remains active and the timer runs out, a function specific to that mode is called. If that mode is switched away f

Re: threads check socket

2009-07-31 Thread Gabriel Genellina
En Fri, 31 Jul 2009 14:42:29 -0300, NighterNet escribió: On Jul 31, 10:23 am, "Gabriel Genellina" wrote: En Fri, 31 Jul 2009 13:35:10 -0300, NighterNet escribió: > I been trying to find a way to check the socket is open or not. The > thread are in a group and loop if the sockets are open

Re: threads check socket

2009-07-31 Thread NighterNet
On Jul 31, 10:23 am, "Gabriel Genellina" wrote: > En Fri, 31 Jul 2009 13:35:10 -0300, NighterNet   > escribió: > > > I been trying to find a way to check the socket is open or not. The > > thread are in a group and loop if the sockets are open. If they are > > not open delete the thread and remov

Re: threads check socket

2009-07-31 Thread Marcus Wanner
On 7/31/2009 12:35 PM, NighterNet wrote: I been trying to find a way to check the socket is open or not. The thread are in a group and loop if the sockets are open. If they are not open delete the thread and remove the group. I need on this. Being a bit more specific would help. Are you using t

Re: threads check socket

2009-07-31 Thread Gabriel Genellina
En Fri, 31 Jul 2009 13:35:10 -0300, NighterNet escribió: I been trying to find a way to check the socket is open or not. The thread are in a group and loop if the sockets are open. If they are not open delete the thread and remove the group. I need on this. What means an "open socket"? Do y

Re: Threads and daemon processes

2009-05-08 Thread Gabriel Genellina
En Fri, 08 May 2009 18:06:02 -0300, Jeffrey Barish escribió: I have a program that uses threading.Timer to execute a function after a delay. It works fine when I run the program normally, but when I run the program as a daemon process, I can't find any evidence that the function ever runs.

Re: Threads not Improving Performance in Program

2009-03-19 Thread Vijayendra Bapte
On Mar 20, 4:21 am, Tim Rowe wrote: > > Thank you for your response. I did not realize that. That seems like a > > huge limitation for such a great language. > > I will look into forking off processes instead of using threads. > > If that's what you need to do, yes it is. If it isn't, no it's not.

Re: Threads not Improving Performance in Program

2009-03-19 Thread Tim Rowe
> Thank you for your response. I did not realize that. That seems like a > huge limitation for such a great language. > I will look into forking off processes instead of using threads. If that's what you need to do, yes it is. If it isn't, no it's not. No language is optimum for all possible appli

Re: Threads not Improving Performance in Program

2009-03-19 Thread Ryan Rosario
On Mar 19, 10:35 am, Jean-Paul Calderone wrote: > On Thu, 19 Mar 2009 09:50:51 -0700, Ryan Rosario > wrote: > >I have a parser that needs to process 7 million files. After running > >for 2 days, it had only processed 1.5 million. I want this script to > >parse several files at once by using mult

Re: Threads not Improving Performance in Program

2009-03-19 Thread Jean-Paul Calderone
On Thu, 19 Mar 2009 09:50:51 -0700, Ryan Rosario wrote: I have a parser that needs to process 7 million files. After running for 2 days, it had only processed 1.5 million. I want this script to parse several files at once by using multiple threads: one for each file currently being analyzed. T

Re: Threads not Improving Performance in Program

2009-03-19 Thread odeits
On Mar 19, 9:50 am, Ryan Rosario wrote: > I have a parser that needs to process 7 million files. After running > for 2 days, it had only processed 1.5 million. I want this script to > parse several files at once by using multiple threads: one for each > file currently being analyzed. > > My code i

Re: Threads and temporary files

2009-03-14 Thread aiwarrior
On Mar 14, 3:01 am, "Gabriel Genellina" wrote: > En Fri, 13 Mar 2009 19:07:46 -0200, aiwarrior   > escribió: > > > I recently am meddling with threads and wanted to make a threaded > > class that instead of processing anything just retrieves data from a > > file and returns that data to a main th

Re: Threads and temporary files

2009-03-14 Thread Lawrence D'Oliveiro
In message <302dd4f5-e9b3-4b0a-b80c- ae43810d8...@e18g2000yqo.googlegroups.com>, aiwarrior wrote: > I recently am meddling with threads and wanted to make a threaded > class that instead of processing anything just retrieves data from a > file and returns that data to a main thread that takes all

Re: Threads and temporary files

2009-03-13 Thread Gabriel Genellina
En Fri, 13 Mar 2009 19:07:46 -0200, aiwarrior escribió: I recently am meddling with threads and wanted to make a threaded class that instead of processing anything just retrieves data from a file and returns that data to a main thread that takes all the gathered data and concatenates it seque

Re: Threads in PyGTK: keep typing while ping-ing

2009-02-18 Thread bieffe62
On 17 Feb, 02:53, Mamahita Sela wrote: > Dear FB, > > > As you have been already told, join() blocks until the > > thread is > > terminated. and you should avoid that. > > A simple fix could by add a timeout to t.join, doing > > something like : > >         t.join(JOIN_TIMEOUT); > >         if not

Re: Threads vs. processes, what to consider in choosing ?

2009-02-17 Thread Christian Heimes
Philip Semanchuk wrote: > The general rule is that it is a lot easier to share data between > threads than between processes. The multiprocessing library makes the > latter easier but is only part of the standard library in Python >= 2.6. > The design of your application matters a lot. For instance

Re: Threads vs. processes, what to consider in choosing ?

2009-02-17 Thread Philip Semanchuk
On Feb 17, 2009, at 10:18 AM, Barak, Ron wrote: I have a wxPython application that builds an internal database from a list of files and then displays various aspects of that data, in response to user's requests. I want to add a module that finds events in a set of log files (LogManager). T

Re: Threads in PyGTK: keep typing while ping-ing

2009-02-16 Thread Mamahita Sela
Dear FB, > As you have been already told, join() blocks until the > thread is > terminated. and you should avoid that. > A simple fix could by add a timeout to t.join, doing > something like : > t.join(JOIN_TIMEOUT); > if not t.isAlive(): > print t.result > Thanks for

Re: Threads in PyGTK: keep typing while ping-ing

2009-02-16 Thread bieffe62
On 16 Feb, 14:47, Mamahita Sela wrote: > Dear All, > > I have read several howtos for threading in PyGTK. I have tried some but with > no luck. > > What i want is: i can keep typing in gtk.TextView while periodically doing > ping some hosts. > > I think, the thread part is working since i can pi

Re: Threads in PyGTK: keep typing while ping-ing

2009-02-16 Thread Jean-Paul Calderone
On Mon, 16 Feb 2009 05:47:22 -0800 (PST), Mamahita Sela wrote: Dear All, I have read several howtos for threading in PyGTK. I have tried some but with no luck. What i want is: i can keep typing in gtk.TextView while periodically doing ping some hosts. You don't need threads for this. The

Re: Threads, forks, multiplexing - oh my

2008-12-21 Thread James Mills
On Mon, Dec 22, 2008 at 11:36 AM, Thomas Raef wrote: > I now want to run multiple instances of this program on a client, after > receiving the command line and args from a broker, dispatcher, whatever you > want to call it. You can use the subprocess module. > I've read where forks will run prog

Re: Threads, GIL and re.match() performance

2008-06-27 Thread Sebastian "lunar" Wiesner
Jeff <[EMAIL PROTECTED]>: > (and possibly intermediate results) These could be stored purely in C space, without refcounting needed. -- Freedom is always the freedom of dissenters. (Rosa Luxemburg) -- http://mail.python.org/mailman/listinfo/python-list

Re: Threads, GIL and re.match() performance

2008-06-26 Thread Jeff
> However, I assumed that calls to (thread safe) C Library functions > release the global interpreter lock. This is mainly applicable to external C libraries. The interface to them may not be thread-safe; anything that uses the Python API to create/manage Python objects will require use of the GI

Re: Threads, GIL and re.match() performance

2008-06-26 Thread Pau Freixes
Hi Ok, if I understand between Py_BEGIN_ALLOW_THREADS and Py_END_ALLOW_THREADS is not possible use a C/Python api functions ? Sorry, but when thread enter another time with Py_END_ALLOW_THREADS this thread enter to competition to lock GIL ? Thks Thks On Thu, Jun 26, 2008 at 12:16 PM, Matthieu

Re: Threads, GIL and re.match() performance

2008-06-26 Thread Matthieu Brucher
Hi, The C-API uses references counts as well, so it is not threadsafe. Matthieu 2008/6/26 Pau Freixes <[EMAIL PROTECTED]>: > But Python C-API[1] it's the main base for extent python with C/c++, and > this is not not threadsafe.? I dont understand > > [1] http://docs.python.org/api/api.html > > O

Re: Threads, GIL and re.match() performance

2008-06-26 Thread Pau Freixes
But Python C-API[1] it's the main base for extent python with C/c++, and this is not not threadsafe.? I dont understand [1] http://docs.python.org/api/api.html On Thu, Jun 26, 2008 at 4:49 AM, Benjamin <[EMAIL PROTECTED]> wrote: > On Jun 25, 9:05 am, Mirko Dziadzka <[EMAIL PROTECTED]> wrote: > >

Re: Threads, GIL and re.match() performance

2008-06-25 Thread Benjamin
On Jun 25, 9:05 am, Mirko Dziadzka <[EMAIL PROTECTED]> wrote: > > 1) Is there a reason for this? I think it is because the Python re library uses the Python C-API which is not threadsafe. > 2) Is the regex library not thread-safe? > 3) Is it possible, to release the GIL in re.match() to >    get m

Re: Threads, GIL and re.match() performance

2008-06-25 Thread Aahz
In article <[EMAIL PROTECTED]>, Mirko Dziadzka <[EMAIL PROTECTED]> wrote: > >I understand that the C implementation of Python use a global interpreter >lock to avoid problems, so doing CPU bound tasks in multiple threads >will not result in better performance on multi-CPU systems. > >However, I as

Re: Threads and import

2008-05-29 Thread Rhamphoryncus
On May 28, 1:14 pm, [EMAIL PROTECTED] wrote: > Hi, > > I'm trying to work out some strange (to me) behaviour that I see when > running a python script in two different ways (I've inherited some > code that needs to be maintained and integrated with another lump of > code). The sample script is: > >

Re: Threads and import

2008-05-28 Thread Peter Otten
[EMAIL PROTECTED] wrote: > Hi, > > I'm trying to work out some strange (to me) behaviour that I see when > running a python script in two different ways (I've inherited some > code that needs to be maintained and integrated with another lump of > code). The sample script is: > > # Sample script,

Re: Threads and import

2008-05-28 Thread Diez B. Roggisch
Python 2.4.4 (#1, Oct 18 2006, 10:34:39) [GCC 4.0.1 (Apple Computer, Inc. build 5341)] on darwin Type "help", "copyright", "credits" or "license" for more information. import TestThread # from TestThread.py If I use python 2.5, this doesn't happen - instead, the module ist just run. If I use py

Re: Threads and import

2008-05-28 Thread rsoh . woodhouse
On May 28, 10:24 pm, "Diez B. Roggisch" <[EMAIL PROTECTED]> wrote: > [EMAIL PROTECTED] schrieb: > > > > > On May 28, 8:52 pm, "Diez B. Roggisch" <[EMAIL PROTECTED]> wrote: > >> [EMAIL PROTECTED] schrieb: > > >>> On May 28, 8:26 pm, "Diez B. Roggisch" <[EMAIL PROTECTED]> wrote: > [EMAIL PROTECT

Re: Threads and import

2008-05-28 Thread Diez B. Roggisch
[EMAIL PROTECTED] schrieb: On May 28, 8:52 pm, "Diez B. Roggisch" <[EMAIL PROTECTED]> wrote: [EMAIL PROTECTED] schrieb: On May 28, 8:26 pm, "Diez B. Roggisch" <[EMAIL PROTECTED]> wrote: [EMAIL PROTECTED] schrieb: Hi, I'm trying to work out some strange (to me) behaviour that I see when run

Re: Threads and import

2008-05-28 Thread rsoh . woodhouse
On May 28, 8:52 pm, "Diez B. Roggisch" <[EMAIL PROTECTED]> wrote: > [EMAIL PROTECTED] schrieb: > > > > > On May 28, 8:26 pm, "Diez B. Roggisch" <[EMAIL PROTECTED]> wrote: > >> [EMAIL PROTECTED] schrieb: > > >>> Hi, > >>> I'm trying to work out some strange (to me) behaviour that I see when > >>> ru

Re: Threads and import

2008-05-28 Thread Diez B. Roggisch
[EMAIL PROTECTED] schrieb: On May 28, 8:26 pm, "Diez B. Roggisch" <[EMAIL PROTECTED]> wrote: [EMAIL PROTECTED] schrieb: Hi, I'm trying to work out some strange (to me) behaviour that I see when running a python script in two different ways (I've inherited some code that needs to be maintaine

Re: Threads and import

2008-05-28 Thread rsoh . woodhouse
On May 28, 8:26 pm, "Diez B. Roggisch" <[EMAIL PROTECTED]> wrote: > [EMAIL PROTECTED] schrieb: > > > > > Hi, > > > I'm trying to work out some strange (to me) behaviour that I see when > > running a python script in two different ways (I've inherited some > > code that needs to be maintained and in

Re: Threads and import

2008-05-28 Thread Diez B. Roggisch
[EMAIL PROTECTED] schrieb: Hi, I'm trying to work out some strange (to me) behaviour that I see when running a python script in two different ways (I've inherited some code that needs to be maintained and integrated with another lump of code). The sample script is: # Sample script, simply creat

Re: threads problem in python

2008-05-13 Thread Gabriel Genellina
En Tue, 13 May 2008 20:46:51 -0300, Astan Chee <[EMAIL PROTECTED]> escribió: Sorry, I mean functions not classes. Well, actually, one is a class and another is a function. So when the script (its a free game btw) runs, it instantiates the first class and somewhere in the middle of processing the

Re: threads problem in python

2008-05-13 Thread Astan Chee
Sorry, I mean functions not classes. Well, actually, one is a class and another is a function. So when the script (its a free game btw) runs, it instantiates the first class and somewhere in the middle of processing the first class, I need to call a function as a separate thread, I also want to

Re: threads problem in python

2008-05-13 Thread castironpi
On May 13, 5:38 am, "Gabriel Genellina" <[EMAIL PROTECTED]> wrote: > En Tue, 13 May 2008 06:42:13 -0300, Astan Chee <[EMAIL PROTECTED]> escribió: > > > I have 2 classes in python, the first one runs first and and then the   > > first one calls the second class. I want it to run the second class as

Re: threads problem in python

2008-05-13 Thread Gabriel Genellina
En Tue, 13 May 2008 06:42:13 -0300, Astan Chee <[EMAIL PROTECTED]> escribió: I have 2 classes in python, the first one runs first and and then the first one calls the second class. I want it to run the second class as a separate thread but I want the first one to wait until the second class

Re: threads and extension module initialization

2008-03-28 Thread Gabriel Genellina
En Fri, 28 Mar 2008 13:17:44 -0300, Diez B. Roggisch <[EMAIL PROTECTED]> escribió: > [EMAIL PROTECTED] schrieb: >> I have an extension module that gets initialized multiple >> times because I am using threads. >> >> How can this module access global state (not per-thread state) ? >> It needs to

Re: threads and extension module initialization

2008-03-28 Thread Diez B. Roggisch
[EMAIL PROTECTED] schrieb: > I have an extension module that gets initialized multiple > times because I am using threads. > > How can this module access global state (not per-thread state) ? > It needs to create a singleton. The question is very unclear. If you are after *not* initializing your

Re: threads and extension module initialization

2008-03-28 Thread Gabriel Genellina
En Fri, 28 Mar 2008 12:25:55 -0300, <[EMAIL PROTECTED]> escribió: > On Mar 28, 11:14 am, "Gabriel Genellina" <[EMAIL PROTECTED]> > wrote: >> En Fri, 28 Mar 2008 11:51:10 -0300, <[EMAIL PROTECTED]> escribió: >> >> > How can this module access global state (not per-thread state) ? >> > It needs to c

Re: threads and extension module initialization

2008-03-28 Thread pianomaestro
On Mar 28, 11:14 am, "Gabriel Genellina" <[EMAIL PROTECTED]> wrote: > C global variables are global, not per-thread. aha, a static pointer gets initialized to NULL, so I can check if it's not NULL in the module initializer. Thanks for jogging my brain, Simon. > > -- > Gabriel Genellina -- ht

Re: threads and extension module initialization

2008-03-28 Thread pianomaestro
On Mar 28, 11:14 am, "Gabriel Genellina" <[EMAIL PROTECTED]> wrote: > En Fri, 28 Mar 2008 11:51:10 -0300, <[EMAIL PROTECTED]> escribió: > > > I have an extension module that gets initialized multiple > > times because I am using threads. > > And do you want thread local variables? no > > > How ca

Re: threads and extension module initialization

2008-03-28 Thread Gabriel Genellina
En Fri, 28 Mar 2008 11:51:10 -0300, <[EMAIL PROTECTED]> escribió: > I have an extension module that gets initialized multiple > times because I am using threads. And do you want thread local variables? > How can this module access global state (not per-thread state) ? > It needs to create a sing

Re: Threads vs. continuations

2008-02-19 Thread Paul Rubin
John Nagle <[EMAIL PROTECTED]> writes: > People did things like that to hammer threading onto operating > systems so dumb they couldn't context switch, like > DOS, early Windows, and MacOS through 7. Nobody does that > any more. I see stuff heading more the other way; here's a description of

Re: Threads vs. continuations

2008-02-19 Thread John Nagle
Tim Daneliuk wrote: > Martin v. Löwis wrote: > Is/Was it not the case, though, that some languages present > a threading model to the programmer that is realized in user > space, but not in the kernel. ISTR some early implementations > of Posix Threads that worked that way. The API was there > a

Re: Threads vs. continuations

2008-02-19 Thread Martin v. Löwis
> That's assuming that the threading implemented at the language > level is actually realized by underlying kernel threading. > Is/Was it not the case, though, that some languages present > a threading model to the programmer that is realized in user > space, but not in the kernel. You were asking

Re: Threads vs. continuations

2008-02-19 Thread Paul Rubin
Tim Daneliuk <[EMAIL PROTECTED]> writes: > 'Not trying to start a fight here, I'm just curious about the > current state of that art. It is the case today that all > modern language threading is realized over a kernel implementation > of threading that behaves as you suggest? Certainly not. See

Re: Threads vs. continuations

2008-02-19 Thread Tim Daneliuk
Martin v. Löwis wrote: >> I've been doing some thinking, and I've halfway convinced myself of >> the following statement: that threads as implemented by Python (or >> Java) are exactly equivalent to one-shot continuations in Scheme. Am >> I right? > > No. In case of threads, progress can be made

Re: Threads vs. continuations

2008-02-19 Thread Martin v. Löwis
> I've been doing some thinking, and I've halfway convinced myself of > the following statement: that threads as implemented by Python (or > Java) are exactly equivalent to one-shot continuations in Scheme. Am > I right? No. In case of threads, progress can be made in an overlapping (concurrent),

Re: Threads vs. continuations

2008-02-19 Thread Arnaud Delobelle
On Feb 19, 8:26 pm, [EMAIL PROTECTED] wrote: [...] > The only thing preventing Python from being > that language is the difficulty of integrating a macro system, n'est- > ce pas? Well there's logix (http://www.livelogix.net/logix/) -- Arnaud -- http://mail.python.org/mailman/listinfo/python-li

Re: Threads vs. continuations

2008-02-19 Thread Aahz
In article <[EMAIL PROTECTED]>, <[EMAIL PROTECTED]> wrote: > >If that's the case, it seems threads plus hygeinic macros and a few >primitives a la Scheme would form a solid basis upon which to build a >programming language. The only thing preventing Python from being >that language is the difficu

Re: Threads vs. continuations

2008-02-19 Thread Tim Daneliuk
[EMAIL PROTECTED] wrote: > I've been doing some thinking, and I've halfway convinced myself of > the following statement: that threads as implemented by Python (or > Java) are exactly equivalent to one-shot continuations in Scheme. Am > I right? (I'd have asked in the scheme groups, but I feel li

Re: threads

2007-09-05 Thread Diez B. Roggisch
vijayca wrote: > i have written a script that spawns some threads > all run in parallel > now i need to stop all the threads once i press a key(example: "\n") > how to do it... That's a FAQ. Search this NG/ML for exhaustive discussions. The quick answer is: - you can't stop externally

Re: Threads and racing conditions

2007-08-22 Thread Nils Oliver Kröger
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Flavio Preto schrieb: > Hi, > > I have a doubt. Supose that i have the minimun class below: > > class db: > def __init__(self): > self.db = {} > def read(self, key): > return self.db[key] > def write(self, key, value): >

Re: threads, mutual exclusion, and lists

2007-08-16 Thread Martin v. Löwis
>> Why do you think they are not? > > Because they aren't. You even mentioned that a few operations that > aren't atomic. OTOH, the OP specifically asked for .append() and .pop(), which are atomic. Regards, Martin -- http://mail.python.org/mailman/listinfo/python-list

Re: threads, mutual exclusion, and lists

2007-08-16 Thread Matt McCredie
> Why do you think they are not? Because they aren't. You even mentioned that a few operations that aren't atomic. If operations are atomic it isn't necessarily because of the design of the list, but the design of CPython. More specifically the GIL. I don't mean to imply that you can't get a multi

Re: threads, mutual exclusion, and lists

2007-08-16 Thread Martin v. Löwis
>> My question is -- are python list operations atomic? If they are not, >> then I assume I need to put some mutual exclusion around the append() >> and pop() calls ? > > They are not, but there is one included in the standard library: > http://docs.python.org/dev/lib/module-Queue.html Why do you

Re: threads, mutual exclusion, and lists

2007-08-15 Thread Matt McCredie
> My question is -- are python list operations atomic? If they are not, > then I assume I need to put some mutual exclusion around the append() > and pop() calls ? They are not, but there is one included in the standard library: http://docs.python.org/dev/lib/module-Queue.html Matt -- http://mai

Re: threads, mutual exclusion, and lists

2007-08-15 Thread Martin v. Löwis
> I have two threads that share a python list. One thread adds to the > list with append(), the other thread removes items with pop(). > > My question is -- are python list operations atomic? Yes, they are in the current implementation of CPython (all versions). Notice that not *all* operations a

Re: threads, mutual exclusion, and lists

2007-08-15 Thread [EMAIL PROTECTED]
On Aug 15, 1:36 pm, Scott <[EMAIL PROTECTED]> wrote: > I have two threads that share a python list. One thread adds to the > list with append(), the other thread removes items with pop(). > > My question is -- are python list operations atomic? If they are not, > then I assume I need to put some mu

Re: Threads Dying?

2007-06-28 Thread felix seltzer
are you using pygtk as well? how are you using your threads, (just out of curiosity into the issue) -felix On 6/28/07, Gabriel Genellina <[EMAIL PROTECTED]> wrote: En Thu, 28 Jun 2007 15:12:53 -0300, Robert Rawlins - Think Blue <[EMAIL PROTECTED]> escribió: > I've got an application that seem

Re: Threads Dying?

2007-06-28 Thread Gabriel Genellina
En Thu, 28 Jun 2007 15:12:53 -0300, Robert Rawlins - Think Blue <[EMAIL PROTECTED]> escribió: > I've got an application that seems to be a little bit unstable and > freezes > quite a bit, and I'm suspecting it's something in one of my threads > that's > causing the problem, when does a threa

Re: Threads, signals and sockets (on UNIX)

2007-06-11 Thread fumanchu
On Jun 11, 3:34 am, geoffbache <[EMAIL PROTECTED]> wrote: > I have a Python program (on UNIX) whose main job is to listen on a > socket, for which I use the SocketServer module. However, I would also > like it to be sensitive to signals received, which it isn't if it's > listening on the socket. ("

Re: Threads, signals and sockets (on UNIX)

2007-06-11 Thread geoffbache
On Jun 11, 2:08 pm, Jean-Paul Calderone <[EMAIL PROTECTED]> wrote: > On Mon, 11 Jun 2007 04:56:43 -0700, geoffbache <[EMAIL PROTECTED]> wrote: > > >> Twisted *should* be able to do this, as it uses non-blocking IO. > > >>http://twistedmatrix.com/trac/ > > >Thanks for the tip. I'll take a look if no

Re: Threads, signals and sockets (on UNIX)

2007-06-11 Thread geoffbache
> > You could probably use the Asyncore stuff to do it as well (with a lot > less stuff). This looked interesting. But it seems the asyncore stuff operates at the socket level, whereas I've currently just got a standard synchronous SocketServer and the socket operations themselves are kind of hid

Re: Threads, signals and sockets (on UNIX)

2007-06-11 Thread Chaz Ginger
geoffbache wrote: >> Twisted *should* be able to do this, as it uses non-blocking IO. >> >> http://twistedmatrix.com/trac/ > > Thanks for the tip. I'll take a look if nobody has any better > suggestions. > > It still seems to me that what I'm trying to do is essentially quite > simple, and should

Re: Threads, signals and sockets (on UNIX)

2007-06-11 Thread Jean-Paul Calderone
On Mon, 11 Jun 2007 04:56:43 -0700, geoffbache <[EMAIL PROTECTED]> wrote: > >> Twisted *should* be able to do this, as it uses non-blocking IO. >> >> http://twistedmatrix.com/trac/ > >Thanks for the tip. I'll take a look if nobody has any better >suggestions. Twisted is a pretty good suggestion in

Re: Threads, signals and sockets (on UNIX)

2007-06-11 Thread geoffbache
> Twisted *should* be able to do this, as it uses non-blocking IO. > > http://twistedmatrix.com/trac/ Thanks for the tip. I'll take a look if nobody has any better suggestions. It still seems to me that what I'm trying to do is essentially quite simple, and shouldn't require as large a tool as T

Re: Threads, signals and sockets (on UNIX)

2007-06-11 Thread Stefan Behnel
geoffbache wrote: > I have a Python program (on UNIX) whose main job is to listen on a > socket, for which I use the SocketServer module. However, I would also > like it to be sensitive to signals received, which it isn't if it's > listening on the socket. ("signals can only be received between ato

Re: THREADS use 100 % CPU all the time

2007-04-11 Thread Gabriel Genellina
En Wed, 11 Apr 2007 08:36:57 -0300, A.B., Khalid <[EMAIL PROTECTED]> escribió: > On Apr 11, 2:38 am, [EMAIL PROTECTED] wrote: >> I have a application where I use different threads. actually all is >> working - BUT I just discovered that the [b]CPU is always 100 % [/ >> b]used. >> > You need you

Re: THREADS use 100 % CPU all the time

2007-04-11 Thread matthiasjanes
On Apr 11, 1:36 pm, "A.B., Khalid" <[EMAIL PROTECTED]> wrote: > On Apr 11, 2:38 am, [EMAIL PROTECTED] wrote: > > > > > Hi all, > > > I have a application where I use different threads. actually all is > > working - BUT I just discovered that the [b]CPU is always 100 % [/ > > b]used. > > > on the 32

Re: THREADS use 100 % CPU all the time

2007-04-11 Thread A.B., Khalid
On Apr 11, 2:38 am, [EMAIL PROTECTED] wrote: > Hi all, > > I have a application where I use different threads. actually all is > working - BUT I just discovered that the [b]CPU is always 100 % [/ > b]used. > > on the 32-bit machine athlon XP, as well as on the amd 64-bit AMD > Athlon(TM) 64 X2 Dual

Re: THREADS use 100 % CPU all the time

2007-04-11 Thread Thomas Krüger
[EMAIL PROTECTED] schrieb: > while (True): > pass > Does anyone know how to run this without consuming all CPU. Your while loop is taking all the CPU time. Thomas -- sinature: http://nospam.nowire.org/signature_usenet.png -- http://mail.python.org/mailman/listinfo/python-list

  1   2   3   >