guile-devel
[Top][All Lists]
Advanced

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

Re: Redoing conditional thread support


From: Mikael Djurfeldt
Subject: Re: Redoing conditional thread support
Date: 15 Oct 2002 15:00:31 +0200
User-agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.2

Marius Vollmer <address@hidden> writes:

> I'm about to reorganize our conditional threading stuff so that there
> is always a thread API (scm_current_thread, scm_call_with_new_thread,
> mutices, condition variables, etc), but when you configure
> "--without-threads" you get a null-thread implementation that doesn't
> allow the creation of new threads.  Thus there will always be only a
> single thread.
> 
> This should make it easier to write code that is thread aware but
> doesn't require threads, like the thread-aware sigaction function.
> 
> Objections?

On the contrary, but Dirk has already made a lot of work on such a
reorganization.  I think there's a branch in the repository which made
a good deal of the way there, if I remember correctly.  Dirk?

The idea was to use a similar technique as has been used in glib,
i.e., a datastructure with a "jump-table" where the initialization
routine of a thread library can "plug in" its C level functions.  The
default values in this datastructure would be the "null" thread
implementation.

The thread interface would be generic enough to allow both for
cooperative threading and pre-emptive threading.  This way, users who
like coop could link guile together with a "libcoop" library and users
who want pthreads could link it with "libguile-pthread" +
"libpthread", while users who don't need threading would not link with
any external thread library.

An important point was that the decision whether to have thread
support or not should *not* be made at compile time since this is a
decision which should be up to the application developer.  This is
possible with the "jump-table" approach described above.

Dirk and I got a long way towards implementing this.  For example, the
data structure mentioned above is implemented.  I'll try to dig up old
documentation + code if you are interested.

Best regards,
Mikael




reply via email to

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