Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Threads and f-stack #855

Open
RainM opened this issue Jan 7, 2025 · 0 comments
Open

Threads and f-stack #855

RainM opened this issue Jan 7, 2025 · 0 comments

Comments

@RainM
Copy link

RainM commented Jan 7, 2025

Hello,

I'm trying to port our network application from kernel's epoll to fstack's implementation.
I compiled hello world application from f-stack sources and it works perfectly. Next step, I incorporated appropriate f-stack's calls to my code (instead of kernel's epoll/socket/...). Here I call ff_init + ff_run in one place but I can't place my logic to ff_run callback. I tried to add sleeps to ff_run's loop and poll f-stack's sockets from another thread (I see ff_pthread_create and set TLS current thread value to my thread) - but it doesn't work. I get no data from f-socket's epoll called in my thread. What I do wrong way? Is it possible to read epoll data from another single thread (f-stack's thread which run ff_run callback will just sleep in this case and my thread will be single reader from sockets)?

Speaking more general way, what is the threading model for F-Stack? I see notes about ff_* functions to be called from business logic threads and these threads are separated from stack's ones. But what ff_pthread_create function does? Why it just copy current thread pointer to TLS variable? Why not just use static variable? If F-Stack is a single-threaded application/stack, is it possible to provide existing thread to f-stack?

--Sergey

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant