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