From: Lynn Winebarger <owinebar@gmail.com>
To: emacs-devel <emacs-devel@gnu.org>
Subject: [GNU ELPA] New package: tam
Date: Sun, 17 Sep 2023 22:28:56 -0400 [thread overview]
Message-ID: <CAM=F=bD9fRXagHLwi8_Hp6FRmMEuRcN6wtQEriYAWP7JSZRW1A@mail.gmail.com> (raw)
I'd like to submit "tam" (table allocation manager) for inclusion in
GNU ELPA. The source is available at
https://github.com/owinebar/emacs-table-allocation-manager
tam provides functions to track the (manual) allocation of a fixed
number of resources to specific objects. All the data structures of
the table are fixed at initialization, so that adding or removing a
particular object should not provoke a garbage collection in any
obvious way. The allocation and deallocation are meant for use in
process sentinels and the like.
I have previously implemented some of the functionality of this
package in a package async-job-queue on MELPA. However, since that
work cannot be assigned to the FSF, I am writing a more general
purpose async job scheduler from scratch. In particular, the
scheduler will provide a facility for users to set a maximum number of
async processes to run simultaneously, then manage the assignment of
those process slots to jobs. The tam functions provide a generic way
to manage that resource allocation in process sentinels. tam.el was
created on September 15, 2023.
;;; tam.el --- Manage use of slots in a fixed size table -*-
lexical-binding: t; -*-
;;; Commentary:
;; Table Allocation Manager
;; Provides an interface to managing the usage of the slots in a fixed size
;; table. All allocation is done during initialization to avoid triggering
;; garbage collection during allocation/free operations.
;; API:
;;
;; (tam-create-table N) => table of size N
;; (tam-table-fullp TABLE) => nil unless TABLE is full
;; (tam-table-emptyp TABLE) => nil unless TABLE is empty
;; (tam-table-size TABLE) => number of slots in TABLE
;; (tam-table-used TABLE) => number of slots of TABLE in use
;; (tam-table-get TABLE IDX) => contents of TABLE slot at index IDX
;; (tam-allocate TABLE OBJ) =>
;; if not full, assigns OBJ to contents of a free slot in TABLE,
;; and returns the index of the slot
;; if full, returns nil
;; (tam-free TABLE INDEX) =>
;; if slot at INDEX of TABLE is in use, move to the free list and
;; return the object formerly held by the slot
;; if slot is already free, signal an error
;; (tam-table-free-list TABLE) => list of free indices in TABLE
;; (tam-table-live-list TABLE) => list of in-use indices in TABLE
Thanks,
Lynn
next reply other threads:[~2023-09-18 2:28 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-09-18 2:28 Lynn Winebarger [this message]
2023-09-18 9:37 ` [GNU ELPA] New package: tam Philip Kaludercic
2023-09-18 16:22 ` Lynn Winebarger
2023-09-18 17:02 ` Philip Kaludercic
2023-09-19 15:38 ` Lynn Winebarger
2023-09-20 8:26 ` Philip Kaludercic
2023-09-20 16:14 ` Lynn Winebarger
2023-09-20 17:30 ` Stefan Monnier via Emacs development discussions.
2023-09-21 4:21 ` Lynn Winebarger
2023-09-21 13:59 ` Stefan Monnier
2023-09-22 3:01 ` Lynn Winebarger
2023-09-22 3:23 ` Stefan Monnier
2023-09-21 16:38 ` Philip Kaludercic
2023-09-18 19:26 ` Adam Porter
2023-09-19 15:48 ` Lynn Winebarger
2023-09-19 16:29 ` Adam Porter
2023-09-21 20:26 ` Richard Stallman
2023-09-22 19:45 ` Adam Porter
2023-09-20 16:06 ` Stefan Monnier
2023-09-20 16:44 ` Lynn Winebarger
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to='CAM=F=bD9fRXagHLwi8_Hp6FRmMEuRcN6wtQEriYAWP7JSZRW1A@mail.gmail.com' \
--to=owinebar@gmail.com \
--cc=emacs-devel@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.