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