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

Re: [MiNT] Multithreaded apps



Hello,

What is the best (most efficent preformancewise on app and OS level) way of doing multithreaded application where each thread could be able to do file/socket IO and be GEM friendly?

It's a good question... which i don't know any simple answer to.

IMO, the best way to have multithread AES friendly application is to use the AES call mt_shel_write(20) to create a thread: The main thread may do all the AES stuff (GUI), and when a new thread has to be created, then the main thread call mt_shel_write(20). This new thread may do file/socket I/O stuff (loop based on Fselect).

... BUT you need a thread safe libc, so you should not use mintlib. Or in your I/O thread, you have to use only gemdos functions (Fopen, Fclose, Fselect...) and never libc functions (fopen, fclose, select...).

Another idea: create 2 applications :

1st application: do the GUI stuff, based on evnt_multi() loop. Get informations from the I/O application thru AES messages (caught by evnt_mutli), and send informations to the I/O application thru a pipe.

2nd application: do the I/O stuff, based on select() loop. Get informations from the GUI thru a pipe (presence of the msg caught by select), and send informations to the GUI thru AES messages.

Hope this help...

best regards,
Arnaud.