[comp.lang.lisp] Lisp - C problem

walker@prlhp1.prl.philips.co.uk (David Walker) (01/03/90)

  I'm running Sun Common Lisp 3.0.1 on mu Sparcstation and linking in code
written in C. One of my c functions calls the sleep subroutine, but the call
to sleep results in no process suspention. i.e. A sleep(5); call returns
immediately. Has anybody experienced the same problem and found a solution?

  Thanks for any help,
                      david walker

davidw@prl.philips.co.uk

Duchier-Denys@cs.yale.edu (Denys Duchier) (01/08/90)

In article <1026@prlhp1.prl.philips.co.uk>, walker@prlhp1 (David Walker) writes:
> 
>   I'm running Sun Common Lisp 3.0.1 on mu Sparcstation and linking in code
> written in C. One of my c functions calls the sleep subroutine, but the call
> to sleep results in no process suspention. i.e. A sleep(5); call returns
> immediately. Has anybody experienced the same problem and found a solution?
> 
>   Thanks for any help,
>                       david walker
> 
> davidw@prl.philips.co.uk

Lucid 3.0 has a multitasking facility. My guess is that they need a
timer to schedule processes. Perhaps your call is interfering with
that other function (see manual page for sleep). Try setting the timer
directly (but make sure to reset it to what it was before), or maybe
do: sleep(0); sleep(5);
This is just guesswork and may have nothing to do with what is
actually going on.

--Denys

galarnea@SRC.Honeywell.COM (Jeff Galarneau) (01/09/90)

>  I'm running Sun Common Lisp 3.0.1 on mu Sparcstation and linking in code
>written in C. One of my c functions calls the sleep subroutine, but the call
>to sleep results in no process suspention. i.e. A sleep(5); call returns
>immediately. Has anybody experienced the same problem and found a solution?

I've run into similar problems, but instead of calling sleep, my C
functions called Oracle. At various times (completely at random) the C
routines would appear to hang and control would never return back to Lisp.
I found that the problem had to do with the Lucid Lisp scheduler.  I
wrapped all of my calls to C with the WITH-SCHEDULING-INHIBITED macro
and that solved my problem. I talked to a person at Lucid about this and he
said that as long as I don't explicitly define scheduler-dependent Lisp 
functions, I wouldn't experience any bad side-effects. So far he's been
right (knock on wood).

Jeff R. Galarneau                    Honeywell, Systems and Research Center
EMAIL: galarnea@src.honeywell.com    MN65-2100
PHONE: (612) 782-7205                3660 Technology Drive
                                     Minneapolis, MN 55418