• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Simultaneous Events (in AS CGI's)
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Simultaneous Events (in AS CGI's)


  • Subject: Re: Simultaneous Events (in AS CGI's)
  • From: Paul Skinner <email@hidden>
  • Date: Fri, 20 Apr 2001 10:32:22 -0400

on 4/19/01 5:22 PM, cris wrote:

> on 19.04.2001 11:33 Uhr, Simon Forster at email@hidden wrote:
>
>> In the last couple of days there have been at least 2 posts asking how
>> AppleScript applications and/or AppleEvents handle simultaneous events. I'd
>> like to know this too.
>>
>> For my part, I wrote an AppleScript CGI which would "email this web page to
>> a friend". It worked fine except, if the CGI was handling a request,
>> subsequent requests seemed to be ignored until the current task had been
>> completed. How to work around this?
>>
>> I imagine that each event should instantiate a new AppleScript object -
>> although whether this is possible in AppleScript and how one does this is
>> unclear to me at this point in time.
>>
>> Any pointers to understanding how AppleScript can handle simultaneous events
>> would be appreciated.
>
> AppleScript CGI's are based on a LIFO (last in first out) concept. Your
> observation is wrong, subsequent requests are executed immediately, which is
> a real problem if the cgi get's more traffic than it can actual handle. In
> such a situation nobody get's an answer from the script. A FIFO based cgi
> would at least serve it's maximum it can handle.
>
> Furthermore LIFO means you have to be very careful with variables declared
> as globals. Use globals only for variables that never change their values
> during the script is working.
> The values of local variables are always held when a subsequent request
> interrupts the current script run. A global variable will be overridden by
> the subsequent request, meaning that the earlier request will continue it's
> work with wrong variable values when the subsequent request has finished.
>
>
>
> cris :-)

Credit where credit is due...
While recently attending the Main Event AppleScript intensive in
Cuppertino I had the opportunity to meet with members of the AppleScript
team and other teams on several occasions. While kicking things around over
lunch Paul (I can't remember his last name, I believe he was on the web
objects team) addressed this LIFO behavior and suggested a nice resolution
to it.
His suggestion was to write a queue into the handler, and/or CGI in this
case, and process requests from the queue. This would allow for a FIFO
operation. I post his sugestion here to hopefully spark a creative
scripter's interest. I haven't had the opportunity ( read as necessity ) to
develop this concept yet but I'd love to use it.
--
Paul Skinner


  • Follow-Ups:
    • Re: Simultaneous Events (in AS CGI's)
      • From: cris <email@hidden>
References: 
 >Re: Simultaneous Events (in AS CGI's) (From: cris <email@hidden>)

  • Prev by Date: Re: problem running apple guidebook modules
  • Next by Date: Re: Stopping a scipt in a Try Statment
  • Previous by thread: Re: Simultaneous Events (in AS CGI's)
  • Next by thread: Re: Simultaneous Events (in AS CGI's)
  • Index(es):
    • Date
    • Thread