home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #20 / NN_1992_20.iso / spool / comp / lang / lisp / 2395 < prev    next >
Encoding:
Text File  |  1992-09-10  |  1.3 KB  |  52 lines

  1. Newsgroups: comp.lang.lisp
  2. Path: sparky!uunet!mcsun!news.funet.fi!cs.joensuu.fi!prikala
  3. From: prikala@cs.joensuu.fi ( Pasi Rikala)
  4. Subject: Sun Common Lisp & Foreign functions
  5. Message-ID: <1992Sep10.122629.8200@cs.joensuu.fi>
  6. Keywords: foreign functions
  7. Organization: University of Joensuu
  8. Date: Thu, 10 Sep 1992 12:26:29 GMT
  9. Lines: 41
  10.  
  11. Hello Lisp-Gurus 
  12.  
  13. I have this strange problem with Sun Common Lisp when trying to use 
  14. functions originally written with c. 
  15.  
  16. My c-function is like this: 
  17.  
  18. /* mytest.c */ 
  19. int my_sleep() 
  20.         int i; 
  21.  
  22.         i = sleep(10); 
  23.         perror("After Sleep"); 
  24.         return(i); 
  25.  
  26. I compile it with "cc -c" to "mytest.o"
  27. And on lisp I say: 
  28. (def-foreign-function (my_sleep         (:return-type :signed-32bit) 
  29.                                         (:name "_my_sleep") 
  30.                                         (:language :c))) 
  31.  
  32. (load-foreign-files "mytest.o") 
  33.  
  34.  
  35. When I call it with (my_sleep), it does not sleep 10 seconds as supposed 
  36. but still returns 0: 
  37. > (my_sleep) 
  38. After Sleep: Interrupted system call 
  39.  
  40. Same thing happens every time I call sleep from my functions.
  41.  
  42. My question is: What am I doing wrong? Why is sleep interrupted? 
  43. How can I tell lisp not to interrupt foreign functions when they 
  44. seem to be sleeping?
  45.  
  46.  
  47. Pasi Rikala    (prikala@cs.joensuu.fi)
  48.