Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Python > report progress from C function

Reply
Thread Tools

report progress from C function

 
 
Michael S
Guest
Posts: n/a
 
      10-31-2006
Good day all.

I rewrote part of my program in C, it's a usually a
long task. I wanted to be able to report the progress
back to my python program. In my module (in addition
to the function that performs the above-mentioned
task) there is a function that returns the variable,
indicating the progress. However I am not sure how to
call it. Once I call the C function that does the work
(it's a while loop that takes minutes sometimes) I
can't call that progress function.
Any ideas?

Thanks in advance,
Michael
 
Reply With Quote
 
 
 
 
John Machin
Guest
Posts: n/a
 
      10-31-2006
Michael S wrote:
> Good day all.
>
> I rewrote part of my program in C, it's a usually a
> long task. I wanted to be able to report the progress
> back to my python program. In my module (in addition
> to the function that performs the above-mentioned
> task) there is a function that returns the variable,
> indicating the progress. However I am not sure how to
> call it. Once I call the C function that does the work
> (it's a while loop that takes minutes sometimes) I
> can't call that progress function.
> Any ideas?
>


What do you expect your "python program" to be doing between calls to
the get_progress function?

Here's a sketch of one possible way of doing something useful: add the
following 2 args to your C "does the work function":
(1) Python function object to be called every n times around the while
loop or every nth other event or every n milliseconds or whatever
(2) n

BTW, why did you rewrite in C rarher than using Pyrex?

Cheers,
John

 
Reply With Quote
 
 
 
 
Fredrik Lundh
Guest
Posts: n/a
 
      11-01-2006
Michael S wrote:

> I downloaded Pyrex and ran it through their own
> example. The code looks quite messy, and I even saw a
> few "goto"s.


looked at the assembler output from your C compiler lately?

</F>

 
Reply With Quote
 
Hendrik van Rooyen
Guest
Posts: n/a
 
      11-02-2006
"Fredrik Lundh" <(E-Mail Removed)> wrote:

> Michael S wrote:
>
> > I downloaded Pyrex and ran it through their own
> > example. The code looks quite messy, and I even saw a
> > few "goto"s.

>
> looked at the assembler output from your C compiler lately?
>
> </F>


LOL! - is it even possible to code an if else without conditional jumps?

- Hendrik

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Progress Report Bill McCarty Firefox 13 08-14-2005 11:47 AM
Swisssvoice IP10S phone - progress report. Alan Foster UK VOIP 1 07-22-2005 10:20 PM
Progress bar to show the progress of a task Charlie Zhang Java 3 08-16-2004 05:53 PM
OT: Progress report Ken Briscoe MCSE 20 05-12-2004 10:53 PM
Microsoft Progress Report Dan Shea Computer Support 2 04-01-2004 09:02 PM



Advertisments