xref: /relibc/pthreads-emb/sched_yield.c (revision 2a260e02a9e300838526be2f2a6e178daef876a7)
1062c5bc4SJason Schmidlapp /*
2062c5bc4SJason Schmidlapp  * sched_yield.c
3062c5bc4SJason Schmidlapp  *
4062c5bc4SJason Schmidlapp  * Description:
5062c5bc4SJason Schmidlapp  * POSIX thread functions that deal with thread scheduling.
6062c5bc4SJason Schmidlapp  *
7062c5bc4SJason Schmidlapp  * --------------------------------------------------------------------------
8062c5bc4SJason Schmidlapp  *
9062c5bc4SJason Schmidlapp  *      Pthreads-embedded (PTE) - POSIX Threads Library for embedded systems
10062c5bc4SJason Schmidlapp  *      Copyright(C) 2008 Jason Schmidlapp
11062c5bc4SJason Schmidlapp  *
12062c5bc4SJason Schmidlapp  *      Contact Email: jschmidlapp@users.sourceforge.net
13062c5bc4SJason Schmidlapp  *
14062c5bc4SJason Schmidlapp  *
15062c5bc4SJason Schmidlapp  *      Based upon Pthreads-win32 - POSIX Threads Library for Win32
16062c5bc4SJason Schmidlapp  *      Copyright(C) 1998 John E. Bossom
17062c5bc4SJason Schmidlapp  *      Copyright(C) 1999,2005 Pthreads-win32 contributors
18062c5bc4SJason Schmidlapp  *
19062c5bc4SJason Schmidlapp  *      Contact Email: rpj@callisto.canberra.edu.au
20062c5bc4SJason Schmidlapp  *
21062c5bc4SJason Schmidlapp  *      The original list of contributors to the Pthreads-win32 project
22062c5bc4SJason Schmidlapp  *      is contained in the file CONTRIBUTORS.ptw32 included with the
23062c5bc4SJason Schmidlapp  *      source code distribution. The list can also be seen at the
24062c5bc4SJason Schmidlapp  *      following World Wide Web location:
25062c5bc4SJason Schmidlapp  *      http://sources.redhat.com/pthreads-win32/contributors.html
26062c5bc4SJason Schmidlapp  *
27062c5bc4SJason Schmidlapp  *      This library is free software; you can redistribute it and/or
28062c5bc4SJason Schmidlapp  *      modify it under the terms of the GNU Lesser General Public
29062c5bc4SJason Schmidlapp  *      License as published by the Free Software Foundation; either
30062c5bc4SJason Schmidlapp  *      version 2 of the License, or (at your option) any later version.
31062c5bc4SJason Schmidlapp  *
32062c5bc4SJason Schmidlapp  *      This library is distributed in the hope that it will be useful,
33062c5bc4SJason Schmidlapp  *      but WITHOUT ANY WARRANTY; without even the implied warranty of
34062c5bc4SJason Schmidlapp  *      MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
35062c5bc4SJason Schmidlapp  *      Lesser General Public License for more details.
36062c5bc4SJason Schmidlapp  *
37062c5bc4SJason Schmidlapp  *      You should have received a copy of the GNU Lesser General Public
38062c5bc4SJason Schmidlapp  *      License along with this library in the file COPYING.LIB;
39062c5bc4SJason Schmidlapp  *      if not, write to the Free Software Foundation, Inc.,
40062c5bc4SJason Schmidlapp  *      59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
41062c5bc4SJason Schmidlapp  */
42062c5bc4SJason Schmidlapp 
43062c5bc4SJason Schmidlapp #include <stdio.h>
44062c5bc4SJason Schmidlapp #include <stdlib.h>
45062c5bc4SJason Schmidlapp 
46062c5bc4SJason Schmidlapp #include "pte_osal.h"
47062c5bc4SJason Schmidlapp 
48062c5bc4SJason Schmidlapp #include "pthread.h"
49062c5bc4SJason Schmidlapp #include "implement.h"
50062c5bc4SJason Schmidlapp #include "sched.h"
51062c5bc4SJason Schmidlapp 
52062c5bc4SJason Schmidlapp int
sched_yield(void)53062c5bc4SJason Schmidlapp sched_yield (void)
54062c5bc4SJason Schmidlapp /*
55062c5bc4SJason Schmidlapp  * ------------------------------------------------------
56062c5bc4SJason Schmidlapp  * DOCPUBLIC
57062c5bc4SJason Schmidlapp  *      This function indicates that the calling thread is
58062c5bc4SJason Schmidlapp  *      willing to give up some time slices to other threads.
59062c5bc4SJason Schmidlapp  *
60062c5bc4SJason Schmidlapp  * PARAMETERS
61062c5bc4SJason Schmidlapp  *      N/A
62062c5bc4SJason Schmidlapp  *
63062c5bc4SJason Schmidlapp  *
64062c5bc4SJason Schmidlapp  * DESCRIPTION
65062c5bc4SJason Schmidlapp  *      This function indicates that the calling thread is
66062c5bc4SJason Schmidlapp  *      willing to give up some time slices to other threads.
67062c5bc4SJason Schmidlapp  *      NOTE: Since this is part of POSIX 1003.1b
68062c5bc4SJason Schmidlapp  *                (realtime extensions), it is defined as returning
69062c5bc4SJason Schmidlapp  *                -1 if an error occurs and sets errno to the actual
70062c5bc4SJason Schmidlapp  *                error.
71062c5bc4SJason Schmidlapp  *
72062c5bc4SJason Schmidlapp  * RESULTS
73062c5bc4SJason Schmidlapp  *              0               successfully created semaphore,
74062c5bc4SJason Schmidlapp  *              ENOSYS          sched_yield not supported,
75062c5bc4SJason Schmidlapp  *
76062c5bc4SJason Schmidlapp  * ------------------------------------------------------
77062c5bc4SJason Schmidlapp  */
78062c5bc4SJason Schmidlapp {
79*2a260e02SJeremy Soller   pte_osThreadSleep (0);
80062c5bc4SJason Schmidlapp 
81062c5bc4SJason Schmidlapp   return 0;
82062c5bc4SJason Schmidlapp }
83