Page 2 of 2
Re: Example of memory pool + struct + mailbox.
Posted: Mon Apr 09, 2012 8:52 am
by mabl
Hello Giovanni,
I'd also really much like to see the mail method you described. Do you still plan on adding this? I have not seen it in the TODO.
Re: Example of memory pool + struct + mailbox.
Posted: Mon Apr 09, 2012 8:59 am
by Giovanni
Yes, it is planned, I just forgot to add it to the to-do list, probably I will give it a try later today.
What is really needed is just a special kind of memory pool where the allocation operation is guarded by a semaphore, probably it would be better give it a more generic name than "mail".
Giovanni
Re: Example of memory pool + struct + mailbox.
Posted: Mon Apr 09, 2012 3:55 pm
by Giovanni
I added this "mail pool" handler to the repository, look under ./os/various, it is not tested yet but very simple.
I didn't add explicit send/receive functions, the normal mailbox functions can be used (mail goes into the mailbox after all

).
It is called "mail pool" but it is a generic pool of objects guarded by a semaphore, probably it will get a more generic name later and included in the kernel.
Giovanni
Re: Example of memory pool + struct + mailbox.
Posted: Tue Mar 03, 2015 3:39 am
by jscott
Hi Giovanni,
I don't see this in current releases... was there some problems with using mail pools?
Or, did you implement them some other way?
I need a way to send intact messages to serial devices and I am looking at
using memory pools to hold my messages, then a "serial server" that retrieves
pool ids from a mail box and zips them out the serial port.
The messages will come from several threads at essentially random times.
Re: Example of memory pool + struct + mailbox.
Posted: Tue Mar 03, 2015 8:50 am
by Giovanni
Hi,
I removed that module from the distribution, you have to get it from some old repository revision (look the history of ./os/various).
You can do exactly the same thing using 2 mailboxes, one containing the unused objects and the other for sending them. It is like a 2-way communication.
Giovanni