Hi Mark & Gil,

thank you both for your help, but I think what it points to is I have not
explained myself.

Both of those aproaches predicate a single client using the server.  Let's
say I have two routines called A & B that both use the server and have
reqires directives in their scripts.

a script called C calls A which calls B
another script D calls B then calls A

Whichever way around they are run, the first one 'require'ed will start up
the server.
If one of them shuts it down when it terminates, then it is not available to
the other.

My problem is not shutting it down, but rather knowing when it is apropriate
to shut it down.

I'm sorry that I'm still worrying away at this on the lists after a year

Jon

On 2 April 2011 16:06, Mark Miesfeld <miesf...@gmail.com> wrote:

> On Sat, Apr 2, 2011 at 7:03 AM, Sahananda (Jon) Wolfers <
> sahana...@windhorse.biz> wrote:
>
>> I have a question, and I hope it is ok to ask it here.
>>
>> It has been brought up by my struggle to move my work to 4.0, but if
>> solved for me could benefit many people.
>>
>>
>>
>> My specific problem is about managing to use rexx/sql with ooRexx 4.0 in a
>> multithreaded environment, but it might b better if I ask the list a more
>> general question.
>>
>>
>>
>> That is, where one has to provide one’s applications with a service that
>> continuously runs, what is the best way to set it up, use it and tear it
>> down.  This question has become more important in 4.0, because there used
>> to be a loophole in ooDialog that allowed one to run methods on the ‘main’
>> thread of a dialog.  Now that has gone, it needs to be done properly.
>>
>>
>>
>> So for me, because rexx\sql needs to run on the thread that the library
>> was loaded on, I have built a little server, I queue message objects on the
>> server, and it performs them on the correct thread.  That all works very
>> well.  My problem pertains to how to set it up when it is first needed,
>> and tear it down when it is finished with.
>>
>
> Well, as always questions like this are hard to answer without knowing what
> your code is doing.
>
> But, one approach comes directly from what you say above.  If you are
> queueing messages to the server, just define a special message that means
> "shut  down".  Then when your application is terminating, send it that
> message.
>
> I doubt that there is any one "right" way to do this.
>
> Another approach is to have some variable that the server checks each time
> it enters its processing loop.  If the variable is true, it drops out of the
> loop and the thread terminates.  Then when the application is terminating
> you set the varible and manually force the server to check if it needs to
> process something.
>
> Again, I'd suggest looking at the sysinfo.rex example in trunk.  It solves
> a problem that seems to be similar to yours, every use of OLE has to be done
> on the same thread.
>
> main\samples\windows\oodialog\sysinfo
>
> --
> Mark Miesfeld
>
>
>
> ------------------------------------------------------------------------------
> Create and publish websites with WebMatrix
> Use the most popular FREE web apps or write code yourself;
> WebMatrix provides all the features you need to develop and
> publish your website. http://p.sf.net/sfu/ms-webmatrix-sf
>
> _______________________________________________
> Oorexx-devel mailing list
> Oorexx-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/oorexx-devel
>
>
------------------------------------------------------------------------------
Create and publish websites with WebMatrix
Use the most popular FREE web apps or write code yourself; 
WebMatrix provides all the features you need to develop and 
publish your website. http://p.sf.net/sfu/ms-webmatrix-sf
_______________________________________________
Oorexx-devel mailing list
Oorexx-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/oorexx-devel

Reply via email to