Re: Creating cores without a toplevel fun

"J. Gareth Williams" <[email protected]> Fri, 28 Nov 2025 00:10:08 -0500
Newsgroups gmane.lisp.steel-bank.general
Message-ID <CALfqwArsTLKHC5WdVf-j=9sUUqOwToy5SoFwo6T4+cotXJNKSg@mail.gmail.com>
So, calling:

    (sb-thread::init-main-thread)

before trying to start #'toplevel-init helped with a whole slew of problems
I was having.

Is it safe to call this?

g


On Thu, Nov 27, 2025 at 9:38 PM J. Gareth Williams <[email protected]>
wrote:

> Hi SBCL folks,
>
> I'm playing around with creating SBCL cores, mostly to use in conjunction
> with libsbcl.so, so they don't have toplevel functions -- they're generally
> intended to provide functionality to be called from C.
>
> I wrote a trivial `main()` that does `initialize_lisp()` and on return, I
> can successfully call my callable-exports.  All good.
>
> But one of my callable exports wants to approximate the behaviour of
> invoking SBCL "natively", and naively calls `#'TOPLEVEL-INIT`, but that
> seems not to work -- it hangs on a futex.  I think it's waiting on another
> thread -- which I have not explicitly created,
>
> I notice that when I run plain SBCL out of the box, I have just one thread
> once it reaches the user REPL, whereas in my scheme, I seem to have *two*
> threads when I return from `initialize_lisp()`:
>
> (#<SB-THREAD:THREAD tid=1350105 "main thread" RUNNING {1201BF8003}>
>  #<SB-THREAD:FOREIGN-THREAD tid=1350105 "callback" RUNNING {1201C58023}>)
>
> Why does this happen?  Is it created *because* there is no toplevel?
> What does it do?  Can I safely ignore it?
>
> Thanks in advance,
> Gareth
>
>
>
>

_______________________________________________
Sbcl-help mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/sbcl-help