Ignore:
Timestamp:
Apr 27, 2004, 8:39:34 PM (21 years ago)
Author:
bird
Message:

GCC v3.3.3 sources.

Location:
branches/GNU/src/gcc
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/GNU/src/gcc

    • Property svn:ignore
      •  

        old new  
        2626configure.vr
        2727configure.vrs
         28dir.info
        2829Makefile
        29 dir.info
        3030lost+found
        3131update.out
  • branches/GNU/src/gcc/libobjc/thr-mach.c

    • Property cvs2svn:cvs-rev changed from 1.1 to 1.1.1.2
    r1390 r1391  
    11/* GNU Objective C Runtime Thread Implementation
    2    Copyright (C) 1996, 1997 Free Software Foundation, Inc.
     2   Copyright (C) 1996, 1997, 2002 Free Software Foundation, Inc.
    33   Contributed by Galen C. Hunt (gchunt@cs.rochester.edu)
    44   Modified for Mach threads by Bill Bumgarner <bbum@friday.com>
     
    3838  privileges.  Once lowered, it cannot be raised.
    3939  */
    40 static int __mach_get_max_thread_priority(cthread_t t, int *base)
     40static int
     41__mach_get_max_thread_priority (cthread_t t, int *base)
    4142{
    4243  thread_t threadP;
     
    4849    return -1;
    4950
    50   threadP  = cthread_thread(t);         /* get thread underlying */
    51 
    52   error=thread_info(threadP, THREAD_SCHED_INFO,
    53                     (thread_info_t)&info, &info_count);
     51  threadP  = cthread_thread (t);        /* get thread underlying */
     52
     53  error = thread_info (threadP, THREAD_SCHED_INFO,
     54                       (thread_info_t) &info, &info_count);
    5455
    5556  if (error != KERN_SUCCESS)
     
    6667/* Initialize the threads subsystem. */
    6768int
    68 __objc_init_thread_system(void)
     69__objc_init_thread_system (void)
    6970{
    7071  return 0;
     
    7374/* Close the threads subsystem. */
    7475int
    75 __objc_close_thread_system(void)
     76__objc_close_thread_system (void)
    7677{
    7778  return 0;
     
    8283/* Create a new thread of execution. */
    8384objc_thread_t
    84 __objc_thread_detach(void (*func)(void *arg), void *arg)
     85__objc_thread_detach (void (*func) (void *arg), void *arg)
    8586{
    8687  objc_thread_t thread_id;
     
    8889
    8990  /* create thread */
    90   new_thread_handle = cthread_fork((cthread_fn_t)func, arg);
    91 
    92   if(new_thread_handle)
     91  new_thread_handle = cthread_fork ((cthread_fn_t) func, arg);
     92
     93  if (new_thread_handle)
    9394    {
    9495      /* this is not terribly portable */
    95       thread_id = *(objc_thread_t *)&new_thread_handle;
    96       cthread_detach(new_thread_handle);
     96      thread_id = *(objc_thread_t *) &new_thread_handle;
     97      cthread_detach (new_thread_handle);
    9798    }
    9899  else
     
    104105/* Set the current thread's priority. */
    105106int
    106 __objc_thread_set_priority(int priority)
    107 {
    108   objc_thread_t *t = objc_thread_id();
     107__objc_thread_set_priority (int priority)
     108{
     109  objc_thread_t *t = objc_thread_id ();
    109110  cthread_t cT = (cthread_t) t;
    110   int maxPriority = __mach_get_max_thread_priority(cT, NULL);
     111  int maxPriority = __mach_get_max_thread_priority (cT, NULL);
    111112  int sys_priority = 0;
    112113
     
    133134
    134135  /* Change the priority */
    135   if (cthread_priority(cT, sys_priority, 0) == KERN_SUCCESS)
     136  if (cthread_priority (cT, sys_priority, 0) == KERN_SUCCESS)
    136137    return 0;
    137138  else
     
    141142/* Return the current thread's priority. */
    142143int
    143 __objc_thread_get_priority(void)
    144 {
    145   objc_thread_t *t = objc_thread_id();
    146   cthread_t cT = (cthread_t) t; /* see objc_thread_id() */
     144__objc_thread_get_priority (void)
     145{
     146  objc_thread_t *t = objc_thread_id ();
     147  cthread_t cT = (cthread_t) t; /* see objc_thread_id () */
    147148  int basePriority;
    148149  int maxPriority;
     
    151152  int interactiveT, backgroundT, lowT; /* thresholds */
    152153
    153   maxPriority = __mach_get_max_thread_priority(cT, &basePriority);
    154 
    155   if(maxPriority == -1)
     154  maxPriority = __mach_get_max_thread_priority (cT, &basePriority);
     155
     156  if (maxPriority == -1)
    156157    return -1;
    157158
     
    167168/* Yield our process time to another thread. */
    168169void
    169 __objc_thread_yield(void)
    170 {
    171   cthread_yield();
     170__objc_thread_yield (void)
     171{
     172  cthread_yield ();
    172173}
    173174
    174175/* Terminate the current thread. */
    175176int
    176 __objc_thread_exit(void)
     177__objc_thread_exit (void)
    177178{
    178179  /* exit the thread */
    179   cthread_exit(&__objc_thread_exit_status);
     180  cthread_exit (&__objc_thread_exit_status);
    180181
    181182  /* Failed if we reached here */
     
    185186/* Returns an integer value which uniquely describes a thread. */
    186187objc_thread_t
    187 __objc_thread_id(void)
    188 {
    189   cthread_t self = cthread_self();
    190 
    191   return *(objc_thread_t *)&self;
     188__objc_thread_id (void)
     189{
     190  cthread_t self = cthread_self ();
     191
     192  return *(objc_thread_t *) &self;
    192193}
    193194
    194195/* Sets the thread's local storage pointer. */
    195196int
    196 __objc_thread_set_data(void *value)
    197 {
    198   cthread_set_data(cthread_self(), (any_t) value);
     197__objc_thread_set_data (void *value)
     198{
     199  cthread_set_data (cthread_self (), (any_t) value);
    199200  return 0;
    200201}
     
    202203/* Returns the thread's local storage pointer. */
    203204void *
    204 __objc_thread_get_data(void)
    205 {
    206   return (void *) cthread_data(cthread_self());
     205__objc_thread_get_data (void)
     206{
     207  return (void *) cthread_data (cthread_self ());
    207208}
    208209
     
    211212/* Allocate a mutex. */
    212213int
    213 __objc_mutex_allocate(objc_mutex_t mutex)
     214__objc_mutex_allocate (objc_mutex_t mutex)
    214215{
    215216  int err = 0;
    216   mutex->backend = objc_malloc(sizeof(struct mutex));
    217 
    218   err = mutex_init((mutex_t)(mutex->backend));
     217  mutex->backend = objc_malloc (sizeof (struct mutex));
     218
     219  err = mutex_init ((mutex_t) (mutex->backend));
    219220
    220221  if (err != 0)
    221222    {
    222       objc_free(mutex->backend);
     223      objc_free (mutex->backend);
    223224      return -1;
    224225    }
     
    229230/* Deallocate a mutex. */
    230231int
    231 __objc_mutex_deallocate(objc_mutex_t mutex)
    232 {
    233   mutex_clear((mutex_t)(mutex->backend));
    234 
    235   objc_free(mutex->backend);
     232__objc_mutex_deallocate (objc_mutex_t mutex)
     233{
     234  mutex_clear ((mutex_t) (mutex->backend));
     235
     236  objc_free (mutex->backend);
    236237  mutex->backend = NULL;
    237238  return 0;
     
    240241/* Grab a lock on a mutex. */
    241242int
    242 __objc_mutex_lock(objc_mutex_t mutex)
    243 {
    244   mutex_lock((mutex_t)(mutex->backend));
     243__objc_mutex_lock (objc_mutex_t mutex)
     244{
     245  mutex_lock ((mutex_t) (mutex->backend));
    245246  return 0;
    246247}
     
    248249/* Try to grab a lock on a mutex. */
    249250int
    250 __objc_mutex_trylock(objc_mutex_t mutex)
    251 {
    252   if (mutex_try_lock((mutex_t)(mutex->backend)) == 0)
     251__objc_mutex_trylock (objc_mutex_t mutex)
     252{
     253  if (mutex_try_lock ((mutex_t) (mutex->backend)) == 0)
    253254    return -1;
    254255  else
     
    258259/* Unlock the mutex */
    259260int
    260 __objc_mutex_unlock(objc_mutex_t mutex)
    261 {
    262   mutex_unlock((mutex_t)(mutex->backend));
     261__objc_mutex_unlock (objc_mutex_t mutex)
     262{
     263  mutex_unlock ((mutex_t) (mutex->backend));
    263264  return 0;
    264265}
     
    268269/* Allocate a condition. */
    269270int
    270 __objc_condition_allocate(objc_condition_t condition)
    271 {
    272   condition->backend = objc_malloc(sizeof(struct condition));
    273   condition_init((condition_t)(condition->backend));
     271__objc_condition_allocate (objc_condition_t condition)
     272{
     273  condition->backend = objc_malloc (sizeof (struct condition));
     274  condition_init ((condition_t) (condition->backend));
    274275  return 0;
    275276}
     
    277278/* Deallocate a condition. */
    278279int
    279 __objc_condition_deallocate(objc_condition_t condition)
    280 {
    281   condition_clear((condition_t)(condition->backend));
    282   objc_free(condition->backend);
     280__objc_condition_deallocate (objc_condition_t condition)
     281{
     282  condition_clear ((condition_t) (condition->backend));
     283  objc_free (condition->backend);
    283284  condition->backend = NULL;
    284285  return 0;
     
    287288/* Wait on the condition */
    288289int
    289 __objc_condition_wait(objc_condition_t condition, objc_mutex_t mutex)
    290 {
    291   condition_wait((condition_t)(condition->backend),
    292                  (mutex_t)(mutex->backend));
     290__objc_condition_wait (objc_condition_t condition, objc_mutex_t mutex)
     291{
     292  condition_wait ((condition_t) (condition->backend),
     293                  (mutex_t) (mutex->backend));
    293294  return 0;
    294295}
     
    296297/* Wake up all threads waiting on this condition. */
    297298int
    298 __objc_condition_broadcast(objc_condition_t condition)
    299 {
    300   condition_broadcast((condition_t)(condition->backend));
     299__objc_condition_broadcast (objc_condition_t condition)
     300{
     301  condition_broadcast ((condition_t) (condition->backend));
    301302  return 0;
    302303}
     
    304305/* Wake up one thread waiting on this condition. */
    305306int
    306 __objc_condition_signal(objc_condition_t condition)
    307 {
    308   condition_signal((condition_t)(condition->backend));
     307__objc_condition_signal (objc_condition_t condition)
     308{
     309  condition_signal ((condition_t) (condition->backend));
    309310  return 0;
    310311}
Note: See TracChangeset for help on using the changeset viewer.