From: Michael R. <re...@eu...> - 2004-03-14 11:10:17
|
Hi Xavier, Hi List, > Okay, I was misinformed about fork. Let's continue this way. I already started with a "simple threading" framework (nothing in CVS by now) > But another question : for example eval needs the mail('unread') value, > so calls a (hypothetical) mail() function in plugin_mail, which forks to > retreive POP summary, and it takes, for example, 5 seconds, what does > the eval do within this time ? I don't know what Michael wants on this > issue. It's simple: The first call to mail::unread() triggers the fork, and returns nothing (this is a drawback: oin the first call you'll never get a senseful result). From now on, the 2nd thread regularly polls the mailbox (at a configurable interval from the config file), ans stores the result in a special shared memory area. The main thread from mail::unread() does nothing but reading this shared memory area and returns the corresponding results. So the main thread is very fast and does never block. The shared memory area itself will be protected by a mutex, to ensure that it's not written to by the poll thread while being read from the mail thread. The best place for such a "shared memory parameter passing structure" would be our well-loved hash. But I'm not shure if this is possible... I am starting this async stuff with the exec() plugin, because its simpler than POP polling, so I can focus on the threading framework. Exec's really need an async model, too, because you never can tell how long the exec'ed prcess will take today. bye, Michael -- Michael Reinelt Tel: +43 676 3079941 Geisslergasse 4 Fax: +43 316 692343 A-8045 Graz, Austria e-mail: re...@eu... |