Just one more note. Although sockets are bidirectional (and thread safe)
Felix cannot handle two requests at once. It can only do half-duplex
communications. 

When a request is made the fthread making it is blocked.
It is vital no other fthread makes a request on that socket until
it the first one is satisfied. The system does not enforce this
so take care. I got caught with this once!

Note that in principle, you'd better not share sockets between pthreads
either. You may get awakened with someone else's request!

At present there is a bug in Felix I think: when you spawn a pthread
you get another event monitor thread too. This was not supposed to
happen! There should only be one, shared by all pthreads. That should
work because the event monitor is already a pthread and has to communicate
with the client pthread's synchronous scheduler, which is must be stored
in the request somehow, so there's no reason the monitor thread
can't service any number of client pthreads. So if you spawn N threads
you should end up with N+2 threads (the main one doing the spawning
+ the event monitor plus the N you spawned) but actually you get
2 (N+1).

Also don't forget, to run the GC, all pthread have to stop.
The GC will wait until they all do. So a single rogue thread
can block all the others. On Linux this can be fixed with
signals, but in general there is no fix for the kind of collector
used by Felix. The problem isn't that the thread needs to be
stopped, but that stopping it is the only way to make it 
do a set_jump() which is how we capture the threads
machine stack and registers. We need to trace them since
a register might point at some heap object.

--
john skaller
skal...@users.sourceforge.net
http://felix-lang.org




------------------------------------------------------------------------------
CenturyLink Cloud: The Leader in Enterprise Cloud Services.
Learn Why More Businesses Are Choosing CenturyLink Cloud For
Critical Workloads, Development Environments & Everything In Between.
Get a Quote or Start a Free Trial Today.
http://pubads.g.doubleclick.net/gampad/clk?id=119420431&iu=/4140/ostg.clktrk
_______________________________________________
Felix-language mailing list
Felix-language@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/felix-language

Reply via email to