AnsweredAssumed Answered

Are IWP scripts multi-threaded?

Question asked by hamrichards on Aug 30, 2012
Latest reply on Sep 1, 2012 by hamrichards

I'm revising a single-user FMP boat-reservation database to enable it to be accessed remotely via IWP. Now for the first time this database will be accessible by multiple users.


One operation of this database displays a set of records of a table, RD, representing available time slots for a given boat on a given date. After updating the records for the desired slots, the user clicks a button to commit the changes and close the time-slot display.


In the new multi-user IWP environment, several users may be working on subsets of table RD’s records simultaneously. As long as the subsets are disjoint, i.e., they represent different boats or different dates, there's no problem, but overlapping subsets must be prevented--we want each user's access to time-slot records for a given (boat,date) to be exclusive. A user requesting to display times for a (boat,date) on which another user is working will be notified that the (boat,date) he's requesting is temporarily busy.


Because each user works on batches of a couple of dozen records, FMP's record locking provisions, which work only for individual records, don't solve this problem. What's needed is for each record to have an in-use indicator, set when it is made active, tested before it is made active, and cleared when it becomes inactive. All of this testing and setting is of course performed by scripts.


If users were able to access this database using several clients, this solution would obviously fail. Two clients could check a record's in-use indicator in quick succession, both concluding that the record was inactive and proceeding accordingly. FMP's record locking would prevent two users from reserving the same time slot, but the timing could work out so that they got alternating slots.


With IWP, however, it's my understanding that there's only a single client serving all IWP users of a given database. In that case, the test-and-set solution works if scripts are single-threaded, i.e., if a script runs to completion for one IWP user before it begins execution for another user.


Is that the case?


Thanks for either an answer or a link to the answer.