unofficial mirror of bug-guile@gnu.org 
 help / color / mirror / Atom feed
From: David Beswick <dlbeswick@gmail.com>
To: 29704@debbugs.gnu.org
Subject: bug#29704: Guile 2.2.2: SRFI-18, condition variables, timeouts
Date: Thu, 14 Dec 2017 12:37:41 +1100	[thread overview]
Message-ID: <47bd4b8a-55fe-bc92-4a64-b8bdeba2e5d5@gmail.com> (raw)

Hello, I'm using Guile 2.2.2 built from source as downloaded from the 
project
website.

$ guile -v
guile (GNU Guile) 2.2.2


I would expect the following command to return in 5 seconds:
$ guile -c '(use-modules (srfi srfi-18)) (let ((cv 
(make-condition-variable)) (m (make-mutex))) (mutex-lock! m) 
(mutex-unlock! m cv 5))'

However, it returns instantly for me. This command works as expected:
$ guile -c "(use-modules ((srfi srfi-18) #:prefix srfi:)) (let ((cv 
(srfi:make-condition-variable)) (m (srfi:make-mutex))) (srfi:mutex-lock! 
m) (srfi:mutex-unlock! m cv (+ (current-time) 5)))"


It's stated on the page https://srfi.schemers.org/srfi-18/srfi-18.html that:

"All synchronization primitives which take a timeout parameter accept three
types of values as a timeout, with the following meaning:

* a time object represents an absolute point in time

* an exact or inexact real number represents a relative time in seconds 
from the
   moment the primitive was called

* #f means that there is no timeout"

Assuming this page is accurate, then the case in the test code
falls under the second dot point from the spec.

The source in module/srfi/srfi-18.scm seems to pass the timeout parameter
unaltered to Guile's wait-condition-variable function, and that parameter is
said in the docs to be "either a integer as returned by ‘current-time’ 
or a pair
as returned by ‘gettimeofday’". I think that would cause the unexpected
behaviour that I see.

I have some time at the moment where I could address this, please let me 
know if
you would like me to work on a fix.

Regards,
David





             reply	other threads:[~2017-12-14  1:37 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-12-14  1:37 David Beswick [this message]
2018-02-16 14:31 ` bug#29704: Guile 2.2.2: SRFI-18, condition variables, timeouts Ludovic Courtès

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/guile/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=47bd4b8a-55fe-bc92-4a64-b8bdeba2e5d5@gmail.com \
    --to=dlbeswick@gmail.com \
    --cc=29704@debbugs.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).