Re: [HELP!] Rev Externals: running a loop without disrupting the stack or inter thread communication

2010-07-25 Thread Andre Garzia
Yes it did but that still needs to materialize! Good to see you here Shao!

By the way, your external is a cocoa external? Are you calling cocoa stuff
from carbon?

Cheers
andre


On Sun, Jul 25, 2010 at 1:30 AM, Shao Sean shaos...@wehostmacs.com wrote:

 Be nice once Rev gets back into the swing of updating their desktop
 offering and the external interface.. The sample they released at a Rev
 conference looks nice and has a sample of spawning a thread and returning
 back to Rev..

 ___
 use-revolution mailing list
 use-revolution@lists.runrev.com
 Please visit this url to subscribe, unsubscribe and manage your
 subscription preferences:
 http://lists.runrev.com/mailman/listinfo/use-revolution




-- 
http://www.andregarzia.com All We Do Is Code.
___
use-revolution mailing list
use-revolution@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-revolution


Re: [HELP!] Rev Externals: running a loop without disrupting the stack or inter thread communication

2010-07-25 Thread Shao Sean

Hopefully they get back on track with updating the desktop offering..

Actually the external is all Carbon.. I have played with a couple  
other single use externals that used Cocoa from Carbon..

___
use-revolution mailing list
use-revolution@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-revolution


Re: [HELP!] Rev Externals: running a loop without disrupting the stack or inter thread communication

2010-07-24 Thread Shao Sean
Be nice once Rev gets back into the swing of updating their desktop  
offering and the external interface.. The sample they released at a  
Rev conference looks nice and has a sample of spawning a thread and  
returning back to Rev..

___
use-revolution mailing list
use-revolution@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-revolution


[HELP!] Rev Externals: running a loop without disrupting the stack or inter thread communication

2010-07-23 Thread Andre Garzia
Folks  Folkettes,

I've written a nice external here which I hope will be the basis of many of
my forthcoming products. My external is a Embeddable Web Server just like
Valentina and SQLite are Embeddable Databases. Among other things, it uses a
poll of threads to serve the web requests. My question is related to how to
trigger a callback on the stack when a request comes.

When there's a web request, the external drives it to some of it's threads,
it might start a new one if needed or reuse an old one. Anyway, the thing
is, the code answering the web request probably is running on a different
thread/process (pthreads) than the rev engine and thus that code can't
execute External SDK calls because Rev Engine likes its calls be made only
from the main thread.

What I need is first a way to notify the main thread when a child thread has
something it wants executed in the rev engine. I am thinking about maybe
using pipes for that or message queues. If you want an example on why this
feature is useful, for example, it is useful for binding URLs to Revolution
Handlers/Commands so that when a request comes, we send NewRequest to the
main stack for example. You might be thinking But andre doesn't that
defeats the purpose of having multiple threads since they will all block
trying to talk to rev single-thread engine?, and the answer is I don't
mean to drive all requests back to rev but to allow some urls to be
connected back to rev so that  you can serve static pages and cgis but also
have some specific urls that can trigger user-defined commands. So for the
external writers among us, using pipes or message queues for inter thread
communication is the best way?

Second question and this probably shows my lack of deep C and Rev Externals
knowledge is, how can we start some eternal looping code in the external.
If you think about the question above, it is clear that something in the
main thread needs to be tied to the other end of the pipe or message queue.
This other piece of code might be blocked with select() or poll() waiting
for something to happen, now, if I create an externalCommand like
webserver_initloop that starts this loop, wouldn't it block the engine if
the function never returns? If this is confusing let me summarize: How can
some code on the external keep processing while returning the control to rev
at the same time.

By the way, guess whos web server external can load revserver engine and
thus create a portable environment for developing local revserver solutions?
Mine!

:D

PS: If anyone knows anything about this please type a couple of words, I
would hate to release my external without my cherished url binding routine.
We still don't have super good information on external writing so things are
hard.

-- 
http://www.andregarzia.com All We Do Is Code.
___
use-revolution mailing list
use-revolution@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-revolution


Re: [HELP!] Rev Externals: running a loop without disrupting the stack or inter thread communication

2010-07-23 Thread Mark Wieder
Andre-

Friday, July 23, 2010, 12:17:47 PM, you wrote:

 Second question and this probably shows my lack of deep C and Rev Externals
 knowledge is, how can we start some eternal looping code in the external.
 If you think about the question above, it is clear that something in the
 main thread needs to be tied to the other end of the pipe or message queue.
 This other piece of code might be blocked with select() or poll() waiting
 for something to happen, now, if I create an externalCommand like
 webserver_initloop that starts this loop, wouldn't it block the engine if
 the function never returns? If this is confusing let me summarize: How can
 some code on the external keep processing while returning the control to rev
 at the same time.

I've done that in an external by writing a complete event-handler loop
as if the external were an application. You can then write your own
event types and catch them in the event loop. It's weird, but it does
the trick.

-- 
-Mark Wieder
 mwie...@ahsoftware.net

___
use-revolution mailing list
use-revolution@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-revolution


Re: [HELP!] Rev Externals: running a loop without disrupting the stack or inter thread communication

2010-07-23 Thread Andre Garzia

  Second question and this probably shows my lack of deep C and Rev
 Externals
  knowledge is, how can we start some eternal looping code in the
 external.
  If you think about the question above, it is clear that something in the
  main thread needs to be tied to the other end of the pipe or message
 queue.
  This other piece of code might be blocked with select() or poll() waiting
  for something to happen, now, if I create an externalCommand like
  webserver_initloop that starts this loop, wouldn't it block the engine
 if
  the function never returns? If this is confusing let me summarize: How
 can
  some code on the external keep processing while returning the control to
 rev
  at the same time.

 I've done that in an external by writing a complete event-handler loop
 as if the external were an application. You can then write your own
 event types and catch them in the event loop. It's weird, but it does
 the trick.


Mark,

But how to you start your event loop? If you start it by calling an
externalcommand from rev, does it block rev?

Thanks for the answer, this will really help me since there's only a single
event!

:D



-- 
http://www.andregarzia.com All We Do Is Code.
___
use-revolution mailing list
use-revolution@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-revolution


Re: Rev Externals

2002-02-22 Thread Kevin Miller

On 20/2/02 10:34 pm, Peter Reid [EMAIL PROTECTED] wrote:

 I've just downloaded the current Mac OS Classic and Mac OS X
 externals from the rev web site and they provide a small number of
 useful extensions.  However, I can't see how I use a single Rev stack
 and build standalones for BOTH Mac OS Classic and Mac OS X?  You seem
 to have to import the externals into your stack, but you can only do
 this for the platform Rev is running on at the time.  If you open a
 Rev stack with externals for the other OS, then Rev crashes out. I
 don't want to have to maintain two separate copies of the stack - one
 for Mac OS Classic and one for Mac OS X, but it seems I have to?! I
 can't see any way of building for both at the same time.
 
 Anyone done this?

This will be sorted out out in 1.1.1 - you will be able to include these two
with different Ids and the correct will be loaded.

Kevin

Kevin Miller [EMAIL PROTECTED] http://www.runrev.com/
Runtime Revolution Limited - Power to the Developer!
Tel: +44 (0) 870 747 1165.  Fax: +44 (0)1639 830 707.

___
use-revolution mailing list
[EMAIL PROTECTED]
http://lists.runrev.com/mailman/listinfo/use-revolution



Re: Rev Externals

2002-02-20 Thread Rob Cozens

I
don't want to have to maintain two separate copies of the stack - one
for Mac OS Classic and one for Mac OS X, but it seems I have to?! I
can't see any way of building for both at the same time.

Hi Peter,

Are you up for a solution that requires three stacks?  If so:

1.  Leave you main stack untouched, except for a preOpen handler I'll
describe in a moment.

2.  Create a minimal stack, eg: Classic Libraries, and place the classic
externals in its resource fork.

3.  Create a minimal stack, eg: OSX Libraries, and place the OS X
externals in its resource fork.

4.  In the preOpen handler for your original stack, determine the version
of the OS and start using stack Classic Libraries or OSX Libraries as
appropriate.

BTW, in all the years start using has been around I don't think anyone
has fully explored how it can be used to change a stack's operation, look,
and/or environment on-the-fly.  The potential power of a simple start
using statement is almost unlimited.

Rob Cozens
CCW, Serendipity Software Company

And I, which was two fooles, do so grow three;
Who are a little wise, the best fooles bee.

from The Triple Foole by John Donne (1572-1631)
___
use-revolution mailing list
[EMAIL PROTECTED]
http://lists.runrev.com/mailman/listinfo/use-revolution