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

Re: [MiNT] Fpoll() in GEM programs



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.