[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [MiNT] Fpoll() in GEM programs



Standa Opichal wrote:

Hi!

Since we wanna add fselect()/fpoll() functionality via evnt_multi() perhaps an extended version of evnt_mult() is in place?


I think I find a better way then the one with extending AES... We can create AES event_multi pipe (e.g. U:\pipe\$PID\event_multi) for each GEM application in XaAES so that the only thing the application needs to use is the Fpoll() to detect activity.
Piece of pseudo code to explain:
# main application loop
while(1) {
  # wait for an event on several filedescriptors
  Fpoll( /pipe/$PID/event_multi, /pipe/fsel, /pipe/xxx );
  # take an action according to the type of event
  switch ( which_pipe ) {
      case event_multi:
         use event_multi() as in every other GEM app.
      case fsel:
         handle pipe comunication
      case xxx:
         ...
  }
}
This seems to me a better way to get the GEM applications capable of using UNIX sockets and other things without being forced to create separate child processes mainly because it would be backward compatible in terms of AES API.
Opinions?

If I understand it's only to know if there is already a message in queue? Because I not see any other type of event able to be manage like this (how AES can know for example that you wan't to wait for a click button?). So if it's for this, there is already a way to do this since AES 4.0, just replace evnt_message() by appl_read(-1,16,message) it will return immediatly with 0 if no message is waiting. Notice you can do an event_multi with timer 0 (not recommand), but it will be probably slower, but for this XAAES is very fast

Olivier