]> git.sur5r.net Git - openldap/blob - libraries/libldap_r/thr_sleep.c
s/<stdlib.h>/<ac/stdlib.h>/
[openldap] / libraries / libldap_r / thr_sleep.c
1 /*
2  * Copyright (c) 1996 Regents of the University of Michigan.
3  * All rights reserved.
4  *
5  * Redistribution and use in source and binary forms are permitted
6  * provided that this notice is preserved and that due credit is given
7  * to the University of Michigan at Ann Arbor. The name of the University
8  * may not be used to endorse or promote products derived from this
9  * software without specific prior written permission. This software
10  * is provided ``as is'' without express or implied warranty.
11  */
12
13 /*
14  * ldap_pvt_thread_sleep.c - allow a thread to sleep without putting
15  * the whole process (e.g. pod under lwp) to sleep.
16  *
17  * Contains platform-specific code to allow this:
18  *
19  * Under non-preemptive threads packages like SunOS lwp, tsleep() adds
20  * the thread to a list of sleepers.  The lwp_scheduler process takes
21  * care of resuming suspended threads.
22  *
23  * Under a fully-preemptive threads package, like Solaris threads,
24  * tsleep just calls sleep(), and there is no scheduler thread.  Life
25  * is so much simpler...
26  */
27
28 #include "portable.h"
29
30 #if !defined( HAVE_LWP )
31
32 #include <stdio.h>
33 #include <ac/stdlib.h>
34 #include <ac/unistd.h>                  /* get sleep() */
35
36 #include "ldap_pvt_thread.h"
37
38
39 /*
40  * Here we assume we have fully preemptive threads and that sleep()
41  * does the right thing.
42  */
43 unsigned int
44 ldap_pvt_thread_sleep(
45         unsigned int interval
46 )
47 {
48         sleep( interval );
49         return 0;
50 }
51
52 #else
53
54 /* LWP implementation of sleep can be found in thr_lwp.c */
55
56 #endif /* HAVE_LWP */