It's true that managing the new multi-threaded nature of Witango 5 is a
challenge. Thread-safety and out-of-order processing needs to be
examined in detail.

One piece of advice is to think that Witango contains no means
what-so-ever to control threads. The point is that it's usually
necessary to use an outside source of control.

I personally like to create a small table in my SQL server which records
the state of certain activities. If something is running, the state will
be set TRUE, and a subsequent request will be errored, or told to wait
(perhaps using a COM call to a wait/delay method). 

If possible, it's also useful to use transactions in SQL. They are
usually very powerful, and can control multiple Witango servers, as well
as requests.

Robert

-----Original Message-----
From: Alan Wolfe [mailto:[EMAIL PROTECTED] 
Sent: Thursday, April 22, 2004 3:12 PM
To: [EMAIL PROTECTED]
Subject: Re: Witango-Talk: Sleep & While + explanations

Yeah truly...

I put in a feature request to witango to have some kind of tag to
designate
the start/stop of a section of code that needed to be threadsafe so that
it
could handle things like this in some way, not sure if thats real
feasible
but i hope it is!

In our code w/ our DB we have had collisions occur and found a way
around
them maybe this can help you out.

We'd have 2 dbms' one right after the other like this:

selext max(id) from table

insert into table id, userno, description values
@@local$resultset[1,1],@@user$gvuserno,'Test'

what would happen is that 2 different requests would occur almost at the
same time so they would get the same ID#, the second insert would throw
an
error since we put a unique restraint on the id.  This is anoying when
you
have to go through and manualy fix data ):

we tried a few different techniques and finaly what we did was make a
helper
table that had 2 columns, one was an auto-incremented integer, and the
other
was a user reference.

instead of selecting the max(id) from the first table, we'd insert the
user
reference into the second table, then select max(id) from the second
table
where the user reference = the user's user reference.  That would give
us
the ID to use in the insert.

The auto-numbering of the column is what saved us here by giving us some
thread safeness,assuring that each request for an ID resulted in a
unique
ID.

It might take some imagination but maybe there's some way you can adapt
this
to your problem.

----- Original Message ----- 
From: <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Thursday, April 22, 2004 11:46 AM
Subject: RE: Witango-Talk: Sleep & While + explanations


>
> Yes, that would work cause I have already used it, but I thought it
was
not
> very "elegant"! ;-)
>
> The resource in question is the DB; I am still unsure how to avoid a
dead
> lock or race conditions.
> I wish With provided a real example on this issue (rather than the
assurance
> that there is always a QUERYTIMEOUT that kicks in).
>
>
>
> -----Original Message-----
> From: Alan Wolfe [mailto:[EMAIL PROTECTED]
> Sent: Thursday, April 22, 2004 10:52
> To: [EMAIL PROTECTED]
> Subject: Re: Witango-Talk: Sleep & While + explanations
>
> wow, im amazed, i thought i had tried that before and it worked.
>
> well...you could always do it this way, not quite an infinite while
loop
but
> maybe close enough for your needs.
>
> This "feature" could also double as a timeout period :P
>
> <@for start=0 stop=100000000 step=1>
>   <@if expr="(expression here)">
>     <@break>
>   </@if>
> </@for>
>
> still doesnt help w/ the sleeping though.
>
> what kind of resource are you waiting on by the way?  maybe with a
little
> more info we could come up with an alternate plan of attack to this?
>
> ----- Original Message -----
> From: <[EMAIL PROTECTED]>
> To: <[EMAIL PROTECTED]>
> Sent: Thursday, April 22, 2004 10:28 AM
> Subject: RE: Witango-Talk: Sleep & While + explanations
>
>
> >
> > I have tried that, but if Step=0, the execution does not enter the
<@FOR>
> > loop.
> > The same is true if Stop < Start.
> >
> > Mike
> > -----Original Message-----
> > From: Alan Wolfe [mailto:[EMAIL PROTECTED]
> > Sent: Thursday, April 22, 2004 09:54
> > To: [EMAIL PROTECTED]
> > Subject: Re: Witango-Talk: Sleep & While + explanations
> >
> > you can use an <@for> like a while loop like so:
> >
> > <@for start=0 stop=1 step=0>
> >
> >   <@if expr="(while expression goes here)">
> >     <@break>
> >   </@if>
> >
> > </@for>
> >
> >
> > ----- Original Message -----
> > From: [EMAIL PROTECTED]
> > To: [EMAIL PROTECTED]
> > Sent: Thursday, April 22, 2004 9:25 AM
> > Subject: RE: Witango-Talk: Sleep & While + explanations
> >
> >
> >
> > I need sleep() (on the server side) to wait for availability on a
locked
> > resource ( without loading the CPU ).
> > If I use an external procedure (dos wait) I am not sure what is the
delay
> > needed to load the DOS interpreter; and I would prefer not to bind
the
the
> > solution to an OS. Java can solve all this (provided it is already
loaded)
> > but I was curious to see if somebody found a simpler way.
> >
> > I was aware of while action and that would work just fine; however
that
> > means I end up fragmenting a results page action; I'd rather use
<@FOR>
if
> I
> > can make it act as a while (which can be done in all programming
languages
> > that I know), but I found no way to do that with witango.
> >
> > I wonder, since there are <@TIMER> and <@FOR> metatags, why not
<@SLEEP>
> and
> > <@WHILE> as well? They are obviously closely related and I assume
they
> > cannot be that difficult to implement...
> >
> >
> > Thank you for all your suggestions.
> > Mike Bravu.
> >
> >
> >
> >
> >
> >
> >
> > From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
> > Sent: Thursday, April 22, 2004 03:28
> > To: [EMAIL PROTECTED]
> > Subject: Witango-Talk: Sleep & While
> >
> >
> > Hello all,
> >
> > Can anybody help me out with the Witango equivalents for:
> > 1- sleep( milliseconds );   and
> > 2- while( true ) { }
> >
> > The solutions that I found are not acceptable:
> > 1-  except for using externals, if I try to use <@TIMER> it seems I
burn
> the
> > CPU, which is not what I want;
> > 2-  <@FOR> </@FOR> does not really work or I do not know how to
setup
> > Start/Step/Stop
> >
> > If the solution is already explained in the documentation I
apologize, I
> > just could not find it.
> >
> >
> > Thank you,
> > Mike Bravu
> >
________________________________________________________________________
> > TO UNSUBSCRIBE: Go to http://www.witango.com/developer/maillist.taf
> >
> >
________________________________________________________________________
> > TO UNSUBSCRIBE: Go to http://www.witango.com/developer/maillist.taf
> >
> >
________________________________________________________________________
> > TO UNSUBSCRIBE: Go to http://www.witango.com/developer/maillist.taf
> >
> >
________________________________________________________________________
> > TO UNSUBSCRIBE: Go to http://www.witango.com/developer/maillist.taf
>
>
________________________________________________________________________
> TO UNSUBSCRIBE: Go to http://www.witango.com/developer/maillist.taf
>
>
________________________________________________________________________
> TO UNSUBSCRIBE: Go to http://www.witango.com/developer/maillist.taf

________________________________________________________________________
TO UNSUBSCRIBE: Go to http://www.witango.com/developer/maillist.taf

________________________________________________________________________
TO UNSUBSCRIBE: Go to http://www.witango.com/developer/maillist.taf

Reply via email to