caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: Laure Danthony <ldanthon@ens-lyon.fr>
To: caml-list@inria.fr
Subject: Unix.sleep et bibliothèque graphique
Date: Thu, 9 Nov 2000 07:38:26 +0100 (MET)	[thread overview]
Message-ID: <200011090638.HAA13067@babar.ens-lyon.fr> (raw)

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain, Size: 4499 bytes --]

suite à quelques essais infructeux et de discussions, voici un résumé du pb :
il s'agit de mettre des pauses au milieu de programmes graphiques qui s'éxécutent trop vite

(*mail de Luc Bougé*)

let n = ref 0 in while (not (key_pressed())) do (lineto !n   
!n; n := !n + 1) done;;                                      
                                                             
Ca marche, mais il faut que la fenetre graphique soit        
activee (par exemple en                                      
pointant dessus).                                            
                                                             
                                                             
J'ai fait quelques essais avec sleep. Je produis d'abord un  
toplevel par##                                               
                                                             
        ocamlmktop -o myocaml graphics.cma unix.cma          
                                                             
1) Le programme suivant marche bien.                         
                                                             
open Graphics;;                                              
open Unix;;                                                  
                                                             
while true do                                                
  print_float (time());                                      
  print_newline();                                           
  Unix.sleep 2;                                              
done                                                         
;;                                                           
                                                             
2) Par contre, si j'ajoute open_graph "", cela               
ne marche plus.                                              
                                                             
open Graphics;;                                              
open Unix;;                                                  
                                                             
open_graph "";;                                              
                                                             
while true do                                                
  print_float (time());                                      
  print_newline();                                           
  Unix.sleep 2;                                              
done                                                         
;;                                                           
                                                             
et la precedente version ne marche plus non plus, meme si je 
tue la fenetre...                                            
                                                             
Je pense qu'il y a un probleme de compatibilite entre les    
deux                                                         
bibliotheques, car la gestion graphique utilise des threads, 
et                                                           
il y a une autre fonction "thread" dans cette bibliotheque.open Graphics;;                                              
open Unix;;                                                  
                                                             
open_graph "";;                                              
                                                             
while true do                                                
  print_float (time());                                      
  print_newline();                                           
  Unix.sleep 2;                                              
done                                                         
;;                                                           
                                                             
et la precedente version ne marche plus non plus, meme si je 
tue la fenetre...                                            
                                                             
Je pense qu'il y a un probleme de compatibilite entre les    
deux                                                         
bibliotheques, car la gestion graphique utilise des threads, 
et                                                           
il y a une autre fonction "thread" dans cette bibliotheque.

(*fin*)

qu'en pensez vous ? Avez vous une solution ?

Merci de votre collaboration, Laure



             reply	other threads:[~2000-11-09 18:10 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2000-11-09  6:38 Laure Danthony [this message]
2000-11-10  9:05 ` Sven LUTHER
2000-11-10 12:47 ` Xavier Leroy

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

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

  git send-email \
    --in-reply-to=200011090638.HAA13067@babar.ens-lyon.fr \
    --to=ldanthon@ens-lyon.fr \
    --cc=caml-list@inria.fr \
    /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 NNTP newsgroup(s).