Welcome Guest Search | Active Topics | Log In | Register

TCP socket binding
#1 Posted : Wednesday, May 15, 2013 3:05:21 PM(UTC)
Rank: Newbie

Groups: Registered
Joined: 5/15/2013(UTC)
Posts: 2
Location: Germany

Thanks: 0 times
Was thanked: 0 time(s) in 0 post(s)
I'm currently working on an extension library for TCP/IP sockets.

I still got a functional API for simple single threaded connections or iterative servers,
but I want to support select() with Squirrel threads (coroutines).

There I have problems to understand native context switching with sq_suspendvm() and sq_wakeupvm().
I want to start any client-threads and the listener-thread suspended an use the select() to wakeup
threads getting data with sq_wakeupvm.
(I use a map of socket fd to HSQUIRRELVM to be able to wakeup threads that got data and resume them after
data processing).

My question is:

what is expected on the stack for each VM and what cleanup is needed when suspending.
Currently I just pass the stored VM to wakeup and do not expecting any result passing
by calling just:

sq_wakeupvm(threadVM, SQFalse, SQFalse, SQFalse, SQFalse);

#2 Posted : Thursday, May 4, 2017 5:36:52 AM(UTC)
Rank: Newbie

Groups: Registered
Joined: 5/4/2017(UTC)
Posts: 1
Location: uae

Thanks: 0 times
Was thanked: 0 time(s) in 0 post(s)
Check this one to know the basics of socket programming...

#3 Posted : Wednesday, May 10, 2017 8:57:48 AM(UTC)
Rank: Advanced Member

Groups: Registered
Joined: 8/23/2014(UTC)
Posts: 138
Location: Northern Germany & Lincolnshire, U.K.

Thanks: 2 times
Was thanked: 10 time(s) in 10 post(s)
you really should have a look at the source code of squirrel instead of making assumptions (sorry to say that).

sq_suspendvm for example effectively does NOTHING relevant.
suspend and resume are meant to build generators and are not suitable to support "true" multitasking at all.
Squirrel VMs are definitely NOT CAPABLE to run in a multithreaded way.

You need a different, non-multithreaded approach. (It's doable though - already done that :P)
Users browsing this topic
Forum Jump  
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.

Clean Slate theme by Jaben Cargman (Tiny Gecko)
Powered by YAF 1.9.4 | YAF © 2003-2010, Yet Another Forum.NET
This page was generated in 0.053 seconds.