Sorry, it's all a bit simpler than i'm making it out to be.

Basically, i want to run racket from c code (embedded i guess, but i'm not
compiling any embedded c files). This is because i want to run everything
in one process. I want to have actual parallelism so that is why i'm using
places. I have one main racket thread that i currently have an infinite
loop using zeromq to listen for messages on. This is a dedicated thread.
But first on that thread i set up two other racket places to do my
concurrent work. The main racket thread then accepts messages and
dispatches to the two places depending on what the message is.

So the question is simply: do i need to have my infinite loop on my main
thread sitting there waiting for messages (and have custom communication),
or is there some better way to do it like just using the standard racket cs
calls.

If i understand correctly, in racket cs embedded if i am not currently
running anything in the main racket thread then gc cannot happen. But the
next time i make a call into racket on that reserved racket thread (which
has not been shut down, and by using racket_apply or some such) then gc can
happen. But i do not know about the other threads that racket has spawned.

Thanks

Nate


On Sun, Sep 13, 2020 at 5:40 PM George Neuner <gneun...@comcast.net> wrote:

>
> On 9/13/2020 4:12 PM, Nate Griswold wrote:
>
> Sorry, i forgot to mention this would be interfacing on the main thread
> from c
>
> does this still hold true? Like if a c call returns does it kill the
> places?
>
> Nate
>
>
> I'm not really sure what you are asking:  it sounds like you are wanting
> to embed Racket into a C program ... if that is the case, then the primary
> thread is in the C program and any/all Racket threads will be secondary.
>
> I don't know that Racket's place API even works in an embedded scenario.
> You certainly can create multiple threads within your C program and run
> Racket in them, but it's hard to share a Racket environment, and if you
> create a separate execution environment for each thread, then their
> operations will be independent of one another.
>
> If you just call a Racket function from C, that function will be executed
> in the same thread as the caller, and it will return to the caller when it
> finishes.  Of course that function could have side effects such as
> signaling a separate Racket thread to terminate.
>
> A lot depends on what you are trying to do and how you structure your
> solution.
>
>
> George
>
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/racket-users/CAM-xLPoKRxGcAKdq89vb%2BRwG8OmKmYxJwnt8DCG7SLPMtk7%3D0Q%40mail.gmail.com.

Reply via email to