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

Re: [MiNT] Fpoll() in GEM programs



Hi, So now it seems that our opinions (mine and Arnaud's) are quite close and that we are seeing the evnt_multi() like extensions as not really having much sense in longer term. I think we are speaking the same language with Arnaud. Also I think Arnaud's proposal is even better than my with those magic pipe creations (these are implementation detail). Arnaud made it up to the application to choose whether it wants to use a filedescriptor or not. My compliments on designs to Arnaud! :) Very good example about extending by Fselect() compatible arguments and later perhaps Fpoll() if someone needs/wants that and next time yet another one. And if you think about this a bit more than you will find out that the AES should be (XaAES is _only partially_ because it needs to use Bconin() due to legacy ROM TOS routines usage and no proper /dev/keyboard, /dev/mouse, /dev/whatever availability) built on top of Fselect()/Fpoll() loop as it is FreeMiNT (UNIX) application. Note that I am not trying to criticize kernel now, I am just trying to give you directions to think. It would be quite easy to provide the filedescriptor (pipe, socket or whatever) for the application signalled upon selected events. Ok, we are 2 (Standa, Arnaud) to 3 (Frank, Ozk, Henk). Please consider cleaner extensions to those that could not last for long term. Konrad? Petr? BTW: Ozk I think this is perfect time to speak about future extensions while the implementation is in progress, because there doesn't need to be pause after it is in the shape you consider n.aes equal. There will be another extension designs ready by that time. ;) Best Regards STanda

Arnaud BERCEGEAY writes:
Hello,
There are two different points of view on this. One with which you would extend AES API and another (my proposed pipes) with which you would make FreeMiNT apps aware of that there is a OS compatible input point _file_ (pipe in this case) where you can detect AES activity.

I was about to do the same remark ;) we can add a MU_SELECT flag and select() parameter to evnt_multi(). ok... but if one prefer prefer poll ? or want to wait for something other (semaphore?)... ok, we can rename MU_SELECT to MU_KERNEL_EVENT and add a big structure in parameter, with a bitmap variable to specify if evnt_multi shall want for select() and/or poll() and/or any other mint futur extension. In my opinion, it's a very bad design: the AES doesn't have to do MINT call in place of the applicaton. I'm not familiar with freemint/kernel-modul/xaaes internals, so maybe i'll say something stupid, but here is my "application" point of view : if an AES want to wait for both event() and select() events, then the main loop should be the select loop. Here is a proposal for AES extension (yes, it's needed anyway):
long evnt_open_fd(void); /* create a file descriptor */
long evnt_set_fd( const EVMULT_IN *in); /* specify what the AES shall wait for */ long evnt_close_fd(long fd); /* close the file descriptor */ and the main loop of the the application may be
{
	long evnt_fd;
EVMULT_IN in = {...}; appl_init();
	evnt_fd = evnt_open_fd();
	evnt_set_fd( evnt_fd, &in);
	
	select() or poll() loop
	{
		switch "fd detected by select or poll"
		case evnt_fd:
			evnt_multi_fast( &in, msg, &out);
			manage_events(msg,&out);
			break;
		case another file descriptor:
			...
	}
	
	evnt_close_fd( evnt_fd);
} The AES should manage itself the filedescritor. The application just have to wait for a particular event (read? exception?) on this file descriptor. The AES should make sure that this event disapears when the application invokes evnt_multi() (empty the file content if the we are waiting for somethin to read in evnt_fd). I have absolutely no idea what this file descriptor may refer to (a pipe ? a socket ? something else ?), but i'm sure you have much more knowledge and idea than me on the subject.

best regards,
Arnaud.