[Top][All Lists]

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

Re : [Chicken-users] hacking the mailbox egg

From: minh thu
Subject: Re : [Chicken-users] hacking the mailbox egg
Date: Sun, 7 Jan 2007 19:53:22 +0100

On Jan 7, 2007, at 10:14 AM, minh thu wrote:

> Hi,
> I'd like to write a small library along the lines of the mailbox egg.
> The goal is to have a queue where the elements are ordered by some
> kind of value attached to them (in my case, it will be the moment when
> the element has to be extracted from the queue).

So essentially a priority queue.
Exactly, just forgot the name...

> Reading the code, and being fairly new to scheme and chicken, I have
> some questions:
> - why is there a queue.scm file ? Is it because usage of the extras
> unit can be disabled ?

No. Because the extras unit doesn't disable interrupts. Mailbox
doesn't synchronize access to its globals explicitly but disables
interrupts, so the entire file is a critical-section.
Does that mean that when a file disables interrupts, when calling code
from another unit, it could be interrupted ?

So using a (disable-interrupts) declaration is a bit like making all
methods of a java class synchronised ?

> - what are those ##sys#xxx and ##core#xxx functions ?
>  is it permitted (good style) to use them ? where are they
> documented ?

Permitted, yes.

Good style? Well, I wouldn't use them unless necessary, or unless
hacking in someone else's code that does use them. You may notice
that 'queue.scm' defines wrappers around the '##sys' access routines
so the main body of the code calls very few directly. And some
operations are just not available outside of the sys namespace, in
which case they must be used.

Documented, no.
Thanks, but, what are they ? What can I use instead of ##sys#slot ? In
the present case, is it ok to use them ?

> When/if I complete the writing of such a library, would it be good to
> add it to Eggs Unlimited ?
> Have you an idea for its name ? ordered-mailbox ?


Ok, thanks !

reply via email to

[Prev in Thread] Current Thread [Next in Thread]