source: rtems/c/src/exec/itron/src/sus_tsk.c @ 0fa51b5b

4.104.114.84.95
Last change on this file since 0fa51b5b was 0fa51b5b, checked in by Jennifer Averett <Jennifer.Averett@…>, on 11/16/99 at 22:46:55

Added code to catch the error of suspend count exceding the counter value.

  • Property mode set to 100644
File size: 1.1 KB
Line 
1/*
2 *  The license and distribution terms for this file may be
3 *  found in the file LICENSE in this distribution or at
4 *  http://www.OARcorp.com/rtems/license.html.
5 *
6 *  $Id$
7 */
8
9#include <limits.h>
10#include <itron.h>
11
12#include <rtems/score/thread.h>
13#include <rtems/score/userext.h>
14#include <rtems/score/wkspace.h>
15#include <rtems/score/apiext.h>
16#include <rtems/score/sysstate.h>
17
18#include <rtems/itron/task.h>
19
20
21/*
22 *  Task-Dependent Synchronization Functions
23 */
24
25/*
26 *  sus_tsk - Suspend Other Task
27 */
28
29ER sus_tsk(
30  ID tskid
31)
32{
33  register Thread_Control *the_thread;
34  Objects_Locations        location;
35
36  the_thread = _ITRON_Task_Get( tskid, &location );
37  switch ( location ) {
38    case OBJECTS_REMOTE:
39    case OBJECTS_ERROR:
40      return _ITRON_Task_Clarify_get_id_error( tskid );
41
42    case OBJECTS_LOCAL:
43
44      if ( _Thread_Is_executing( the_thread ) )
45        _ITRON_return_errorno( E_OBJ );
46
47      if (the_thread->suspend_count == INT_MAX )
48        _ITRON_return_errorno( E_QOVR );
49
50      _Thread_Suspend( the_thread );
51      break;
52  }
53
54  _ITRON_return_errorno( E_OK );
55}
56
57
58
59
60
61
62
Note: See TracBrowser for help on using the repository browser.