Hi Liang, As you pointed out, the interpreter will only run a single thread at a time - so there's no need for your start and stop functions to be re-entrant. For the duration of the request, the interpreter your code is running in is all yours.
-Nick Johnson On Sun, May 31, 2009 at 8:12 AM, Liang Han <[email protected]> wrote: > > I know multi-thread is not supported by google app engine, and also I > know the production server can create as many instances as needed to > support requests from many clients. (If I'm wrong, please correct > me.) > > But the problem I'm trying to solve is that when I want to add some > code around some method to calculate the time spent on that method, I > have no way to get the Thread ID or instance ID. > > Here's the pseudocode. > > start(appName, transName) > ... we do a lot of things here ... > stop(appName, transName) > > The “start” and “stop” functions are written by myself, which > basically record the time in memcache. After that, the time spent is > calculated. > > But the issue here is that we want to know the unique ID of this > thread, because it could be invoked by multiple clients concurrently, > and without this unique ID, things are messed up. I tried to use > thread.get_ident(), but it always return -1. > > Does anybody have idea on that? Thanks very much in advance. > > --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Google App Engine" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/google-appengine?hl=en -~----------~----~----~----~------~----~------~--~---
