Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unix.select #3138

Closed
vicuna opened this issue Jan 10, 2002 · 2 comments
Closed

Unix.select #3138

vicuna opened this issue Jan 10, 2002 · 2 comments
Labels

Comments

@vicuna
Copy link

vicuna commented Jan 10, 2002

Original bug ID: 793
Reporter: administrator
Status: closed
Resolution: not a bug
Priority: normal
Severity: minor
Category: ~DO NOT USE (was: OCaml general)

Bug description

Full_Name: Luc Habert
Version: 3.04
OS: Linux
Submission from: gargamel.ens.fr (129.199.131.138)

I am experiencing a problem when using Unix.select while the graphics
window is open :

#load "unix.cma";;

#load "graphics.cma";;

Graphics.open_graph "";;

  • : unit = ()

Unix.select [] [] [] 1.;;

Exception: Unix.Unix_error (Unix.EINTR, "select", "").

This happens as well in the toplevel as in byte or native compiled
programs.

@vicuna
Copy link
Author

vicuna commented Jan 11, 2002

Comment author: administrator

From: luc.habert@inria.fr
Subject: Unix.select (#3138)
Date: Thu, 10 Jan 2002 13:02:43 +0100 (MET)
Message-ID: 200201101202.NAA13227@pauillac.inria.fr

Full_Name: Luc Habert
Version: 3.04
OS: Linux
Submission from: gargamel.ens.fr (129.199.131.138)

I am experiencing a problem when using Unix.select while the graphics
window is open :

#load "unix.cma";;

#load "graphics.cma";;

Graphics.open_graph "";;

  • : unit = ()

Unix.select [] [] [] 1.;;

Exception: Unix.Unix_error (Unix.EINTR, "select", "").

This happens as well in the toplevel as in byte or native compiled
programs.

This is not a bug: the select system call is interrupted by
the Graphics librarie's internal use of interval timer.
The quick workaround is as follows, (though it is not so presice):

let sleep sec =
let start = Unix.gettimeofday () in
let rec delay t =
try Unix.Unix_error(Unix.EINTR, _, _) ->
let now = Unix.gettimeofday () in
let remaining = start +. n -. now in
if remaining > 0.0 then delay remaining
in
delay sec
;;

--
JPF

@vicuna
Copy link
Author

vicuna commented Jan 11, 2002

Comment author: administrator

Acceptable Linux behavior with timer signals

@vicuna vicuna closed this as completed Jan 11, 2002
@vicuna vicuna added the bug label Mar 19, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant