Re: [Chicken-users] SRFI-27 and 3.5.0

2009-02-26 Thread Jim Ursetto
On Wed, Feb 25, 2009 at 7:48 PM, Ivan Raikov ivan.g.rai...@gmail.com wrote:
 For the time being, I have reverted srfi-18.scm to that of Chicken
 release 3.4.0. This fixes the issues you reported with srfi-18 and
 srfi-27.

I have restored the latest version of srfi-18 and fixed some bugs and
everything tests okay now.  The patch is attached below, and I have
also applied it to the repository.

Jim
Index: srfi-18.scm
===
--- srfi-18.scm (revision 13178)
+++ srfi-18.scm (working copy)
@@ -188,7 +188,7 @@
   (##sys#slot th 8) )
 
 (define-inline (%thread-mutexes-set! th wt)
-  (##sys#setslot th 8 wx) )
+  (##sys#setslot th 8 wt) )
 
 (define-inline (%thread-mutexes-empty? th)
   (null? (%thread-mutexes th)) )
@@ -399,7 +399,7 @@
   (max 0 (+ s C_startup_time_seconds)) )
 
 (define-inline (%seconds-milliseconds s)
-  (* (##sys#flonum-fraction (##sys#exact-inexact s)) 1000) )
+  (* s 1000) )
 
 (define-inline (%milliseconds-seconds ms)
   (/ ms 1000) )
@@ -473,17 +473,19 @@
   (set! make-thread
 (lambda (thunk #!optional (name (gensym 'thread)))
   (##sys#check-closure thunk 'make-thread)
-  (%make-thread
-   name
-   (lambda ()
-(##sys#call-with-values
- thunk
- (lambda results
-   (%thread-results-set! thread results)
-   (##sys#thread-kill! thread 'dead)
-   (##sys#schedule))) )
+  (let ((thread (%make-thread name #f)))
+(%thread-thunk-set!
+ thread 
+ (lambda ()
+   (##sys#call-with-values
+thunk
+(lambda results
+  (%thread-results-set! thread results)
+  (##sys#thread-kill! thread 'dead)
+  (##sys#schedule)
+thread))) )
 
-(define (thread? x) (%thread x))
+(define (thread? x) (%thread? x))
 
 (define (current-thread) ##sys#current-thread)
 
@@ -611,7 +613,7 @@
 (lambda (#!optional (id (gensym 'mutex)))
   (%make-mutex id) ) ) )
 
-(define (mutex? x) (%mutex x))
+(define (mutex? x) (%mutex? x))
 
 (define (mutex-name mutex)
   (%check-mutex mutex 'mutex-specific)
___
Chicken-users mailing list
Chicken-users@nongnu.org
http://lists.nongnu.org/mailman/listinfo/chicken-users


Re: [Chicken-users] calling CHICKEN_eval from different threads

2009-02-26 Thread felix winkelmann
On Thu, Feb 26, 2009 at 3:19 AM, Jan Baumgart raga.r...@gmx.de wrote:
 Hi!

 Is it possible, to make subsequent calls to CHICKEN_eval from within
 different nonreentrant(!) threads?

No, the chicken runtime system is not thread-safe.


cheers,
felix


___
Chicken-users mailing list
Chicken-users@nongnu.org
http://lists.nongnu.org/mailman/listinfo/chicken-users


Re: [Chicken-users] calling CHICKEN_eval from different threads

2009-02-26 Thread Jan Baumgart

Sorry, I've mixed up the terminology for reentrant.
I actually meant the opposite:
The chicken runtime system gets called only after the previous call 
(from another thread) has returned.

Chicken_eval gets blocked by a mutex lock.

I've also tested the scenario without the locks, to avoid any 
possibility of deadlocks, while
making sure, the threads don't call chicken at the same time. But 
chicken_eval still hangs.


felix winkelmann wrote:

On Thu, Feb 26, 2009 at 3:19 AM, Jan Baumgart raga.r...@gmx.de wrote:

Hi!

Is it possible, to make subsequent calls to CHICKEN_eval from within
different nonreentrant(!) threads?


No, the chicken runtime system is not thread-safe.


cheers,
felix



___
Chicken-users mailing list
Chicken-users@nongnu.org
http://lists.nongnu.org/mailman/listinfo/chicken-users


Re: [Chicken-users] calling CHICKEN_eval from different threads

2009-02-26 Thread Thomas Chust
Hello,

even if the calls don't occur in parallel, invoking the CHICKEN
interpreter from different threads is problematic, since distinct
threads usually have distinct stacks which will get CHICKEN's
allocator confused.

If you manage to update the stack base pointer for the allocator
before entering the evaluator every time a thread switch occured, and
if you also make sure that at most one thread is running CHICKEN code
at any time, this should probably work.

cu,
Thomas


-- 
When C++ is your hammer, every problem looks like your thumb.


___
Chicken-users mailing list
Chicken-users@nongnu.org
http://lists.nongnu.org/mailman/listinfo/chicken-users


Re: [Chicken-users] SRFI-27 and 3.5.0

2009-02-26 Thread Jim Ursetto
On Thu, Feb 26, 2009 at 12:48 PM, Peter Danenberg pe...@ck12.org wrote:
 Should we just pull it down from:

   https://galinha.ucpel.tche.br/svn/chicken-eggs/chicken/branches/chicken-3/

 or are you going to make a release?

It will make it into 3.5.2, but it doesn't contain any functionality
or API changes; it was only an internal rewrite.  So you can continue
to use the 3.5.1 snapshot.


___
Chicken-users mailing list
Chicken-users@nongnu.org
http://lists.nongnu.org/mailman/listinfo/chicken-users


[Chicken-users] I'm confused (again)

2009-02-26 Thread William Ramsay

Hi again,

This may seem like a strange question, but I'm confused about the use of 
set!.It may be a holdover from my pre-scheme days, but it seems I 
should be declaring a variable before using it with set!.   In other 
words, I would use:


  (let
 ((x  0))

before setting x based on some value not available when x is declared.

But it appears that set! itself declares the variable and the let is not 
needed.   Is this correct or is my code just working magically?
And if set! does declare a variable what is it's scope?I've been 
writing scheme for a couple of years and just decided I have no idea 
what I'm doing.   (but, then again, that's what makes programming such fun)


Bill



___
Chicken-users mailing list
Chicken-users@nongnu.org
http://lists.nongnu.org/mailman/listinfo/chicken-users


Re: [Chicken-users] I'm confused (again)

2009-02-26 Thread John Cowan
William Ramsay scripsit:

 This may seem like a strange question, but I'm confused about the use
 of set!.  It may be a holdover from my pre-scheme days, but it seems
 I should be declaring a variable before using it with set!.

A Scheme implementation is allowed to either let you set! variables that
have not been declared with define or bound with lambda/let/let*/letrec
etc., or to make it an error to do so.  Chicken belongs to the first type.

-- 
John Cowan  co...@ccil.orghttp://ccil.org/~cowan
Big as a house, much bigger than a house, it looked to [Sam], a grey-clad
moving hill.  Fear and wonder, maybe, enlarged him in the hobbit's eyes,
but the Mumak of Harad was indeed a beast of vast bulk, and the like of him
does not walk now in Middle-earth; his kin that live still in latter days are
but memories of his girth and his majesty.  --Of Herbs and Stewed Rabbit


___
Chicken-users mailing list
Chicken-users@nongnu.org
http://lists.nongnu.org/mailman/listinfo/chicken-users


Re: [Chicken-users] I'm confused (again)

2009-02-26 Thread Jim Ursetto
On Thu, Feb 26, 2009 at 3:12 PM, William Ramsay ramsa...@comcast.net wrote:
 This may seem like a strange question, but I'm confused about the use of
 set!.    It may be a holdover from my pre-scheme days, but it seems I should
 be declaring a variable before using it with set!

William,

Check out http://chicken.wiki.br/Extensions%20to%20the%20standard
under 4.1.6.  In Chicken, set! for unbound toplevel variables is
allowed.  Also check out R5RS section 5.2.1.

You might prefer, for style or portability, to have a dummy definition
at toplevel, such as (define foo #f) or just (define foo), prior to
performing the set!.

Jim


___
Chicken-users mailing list
Chicken-users@nongnu.org
http://lists.nongnu.org/mailman/listinfo/chicken-users


Re: [Chicken-users] I'm confused (again)

2009-02-26 Thread Thomas Chust
2009-02-26 William Ramsay ramsa...@comcast.net:
 [...]
 But it appears that set! itself declares the variable and the let is not
 needed.
 [...]
 And if set! does declare a variable what is it's scope?
 [...]

Hello,

if I'm not mistaken, using set! on a variable that hasn't been
declared is equivalent to declaring it in the top level and using set!
on it.

However, this is not a feature that is portable between different
Scheme implementations.

cu,
Thomas


-- 
When C++ is your hammer, every problem looks like your thumb.


___
Chicken-users mailing list
Chicken-users@nongnu.org
http://lists.nongnu.org/mailman/listinfo/chicken-users


Re: [Chicken-users] I'm confused (again)

2009-02-26 Thread Jim Ursetto
On Thu, Feb 26, 2009 at 3:46 PM, Jim Ursetto zbignie...@gmail.com wrote:
 You might prefer, for style or portability, to have a dummy definition
 at toplevel, such as (define foo #f) or just (define foo), prior to
 performing the set!.

Whoops.  To be clear, (define foo) is a Chicken extension.  For
portability, use (define foo #f) or similar.


___
Chicken-users mailing list
Chicken-users@nongnu.org
http://lists.nongnu.org/mailman/listinfo/chicken-users


Re: [Chicken-users] Segmentation Fault in C_mutate on Chicken 3.5.0 (OpenBSD i386)

2009-02-26 Thread Taylor Venable
On Mon, Feb 23, 2009 at 08:14:41PM -0500, Taylor Venable wrote:
 Using Chicken 3.5.0 on OpenBSD 4.5-beta I get segmentation faults when using 
 the
 http egg.  This occurs every time when a 404 or 500 error is generated by the
 http-server. 

Happily, this seems to have been fixed by reverting the SRFI-18
implementation in devel release 3.5.1 - thanks!

-- 
Taylor Christopher Venable
http://real.metasyntax.net:2357/


___
Chicken-users mailing list
Chicken-users@nongnu.org
http://lists.nongnu.org/mailman/listinfo/chicken-users


Re: [Chicken-users] Segmentation Fault in C_mutate on Chicken 3.5.0 (OpenBSD i386)

2009-02-26 Thread Peter Danenberg
Quoth Taylor Venable on Boomtime, the 57th of Chaos:
 Happily, this seems to have been fixed by reverting the SRFI-18
 implementation in devel release 3.5.1 - thanks!

Christ; no wonder SRFI-18 is in core: its reach is almost ubiquitous.


___
Chicken-users mailing list
Chicken-users@nongnu.org
http://lists.nongnu.org/mailman/listinfo/chicken-users


[Chicken-users] synch test code.

2009-02-26 Thread Nicholas Indy Ray
I'm working on trying to port the synch egg to chicken 4 as it's
required by a few others (notably sqlite3). However I have no code
that uses it without requirements to many other eggs that aren't part
of chicken 4. If anyone has any test code for synch, or other code
that should run cleanly on chiken 4 otherwise I'd appreciate getting
ahold of it for testing purposes.

Nicholas Indy Ray


___
Chicken-users mailing list
Chicken-users@nongnu.org
http://lists.nongnu.org/mailman/listinfo/chicken-users