FUDforum
Fast Uncompromising Discussions. FUDforum will get your users talking.

Home » Imported messages » comp.lang.php » anyone else writing Linux (or cross-system) applications in PHP?
Show: Today's Messages :: Polls :: Message Navigator
Return to the default flat view Create a new topic Submit Reply
Re: anyone else writing Linux (or cross-system) applications in PHP? [message #180301 is a reply to message #180295] Mon, 04 February 2013 09:49 Go to previous messageGo to previous message
crankypuss is currently offline  crankypuss
Messages: 147
Registered: March 2011
Karma:
Senior Member
On 02/04/2013 12:40 AM, Arno Welzel wrote:
> crankypuss, 2013-02-03 11:49:
>
>> On 02/02/2013 02:27 PM, Jonathan N. Little wrote:
> [...]
>>> Because for the web is where PHP originated. Get data, do something,
>>> done. Not really suited for event driven apps.
>>
>> I have code that says you're mistaken.
>
> In which way? How does your PHP code handle events without polling in an
> endless loop?
>
>

There's only two ways to handle repetitive events, interrupts and
polling. No modern operating system polls by using a hard spin-loop,
and no application that isn't a total piece of crap ever implements a
hard spin-loop without some kind of system-call that allows it to be set
aside while the processor services another thread. Whether your
application contains a loop that has a system-call in it, or is
rescheduled when an interrupt comes in, it's the same loop with its top
rolled around and a different subroutine used to put it to sleep. Hell,
even if your application is so stupid that it's just branching to here,
any modern operating system will time-swap it out and let somebody else
have a shot at the processor.

So the answer depends somewhat on how one interprets "even driven". All
applications are event driven unless they are just doing hard
computation, in/grind/out. The techniques one uses to make the
application do what's intended vary depending on details. In other
words it depends on what you want to do. Polling is not bad if done
properly, neither are interrupt-based mechanisms, look close enough and
they're basically the same thing.

As for PHP being "not really suited for event driven apps" that seems
kind of silly to me, but then most people think that calling ncurses to
get a character means their application will have to sit there waiting
until the ENTER key is pressed. Sure, the ncurses call is blocking, but
that doesn't mean you can't write a non-blocking subroutine that does
something that's blocking; only threads get blocked, big deal.
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Problem with readdir and ssh2
Next Topic: web designers and developers
Goto Forum:
  

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ]

Current Time: Tue Nov 26 15:20:06 GMT 2024

Total time taken to generate the page: 0.04903 seconds