Re: mt questions

Vladimir Tzankov <[email protected]>
Newsgroups gmane.lisp.clisp.devel
Message-ID <CAHWYE6KTqhW3DMFioLe_czT824Km0H1-v3xsaZrgCh7oJPykSQ@mail.gmail.com>
> 1.  Is test-and-set faster than compare-and-swap?
testandset in xthread.d is special case of cas with 0/1 values.


> 2.  In [xthread.d, line 104 ]  its mentioned "raw mutex used for thread
> suspension/resume". What does a raw mutex refer to here? Is it any
> different from a normal mutex? Does by raw mutex you mean .. simply
> a mutex (! mutex/condition variable pair) ?

In all comments "raw" mutex means operating system mutex while "mutex"
means lisp object mutex (see lispbibl.d:6831).
"raw" mutex is used for lisp mutex implementation.

> 3.  I came across futex. It's a kernel facility the enables fast
> implementations
> of mutex in userspace and is used to implement basic locking. Why don't we
> incorporate it in achieving locking ? since Pthread Mutex in the latest
> Linux
> distributions are implemented through Futex logic.

futex is linux only thing. clisp runs on bsd, win32, etc. Also futex
cannot be used with condition variables.

> 4.  In [xthread.d, line 52 ] I could not understand the 'Create a new
> thread'
> method's  void* (*startroutine)(void*) argument. Please, also provide me
> with a definition of startroutine.

See zthread.d:228
This is start routine for all threads created from lisp code.

> 5.  In [xthread.d, line 99,152] what does #define THREADPROC_SIGNATURE do?
This is just a syntax sugar to hide win32/posix thread function return type.

> 6.  In [xthread.d, line 156],  its mentioned 'an inefficient implementation
> of
> condition variable for win32.'. Why don't we use windows 'Events' instead of
> a condition variable, since I read they are like a mutex/condition pair
> wrapped
> around a boolean.
> plus there's also a to-do marked there-  "TODO : make it better."

Condition variable emulation on win32 is not exactly inefficient but
is not fair for sure. Win32 event is very different compared to posix
condition variables - please go over related docs again.
Recent win32 versions (not sure from when exactly) have real condition
variables (http://msdn.microsoft.com/en-us/library/windows/desktop/ms682052(v=vs.85).aspx).
The reason we do not use them is that we want to support windows xp as
well. Of course some ifdefs are possible but nobody bothered yet.

------------------------------------------------------------------------------
"Accelerate Dev Cycles with Automated Cross-Browser Testing - For FREE
Instantly run your Selenium tests across 300+ browser/OS combos.  Get 
unparalleled scalability from the best Selenium testing platform available.
Simple to use. Nothing to install. Get started now for free."
http://p.sf.net/sfu/SauceLabs
_______________________________________________
clisp-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/clisp-devel
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.