Ignore:
Timestamp:
Oct 5, 2018, 12:21:52 AM (6 years ago)
Author:
alain
Message:

Cosmetic.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/libs/libpthread/pthread.h

    r477 r573  
    22 * pthread.h - User level <pthread> library definition.
    33 *
    4  * Author     Alain Greiner (2016,2017)
     4 * Author     Alain Greiner (2016,2017,2018)
    55 *
    66 * Copyright (c) UPMC Sorbonne Universites
     
    2626
    2727//////////////////////////////////////////////////////////////////////////////////////////////
    28 //             POSIX Threads related functions (including barriers and mutexes)
     28//             POSIX thread related functions
     29//
     30//  This include the thread creation/destruction, as well as the synchronisations:
     31//  barriers, mutexes, and condition variables.
    2932//////////////////////////////////////////////////////////////////////////////////////////////
    3033
     
    7275 * pointer available to any successful pthread_join() with the terminating thread.
    7376 *********************************************************************************************
    74  * @ exit_vallue  : [in] pointer to be returned to parent thread if thead is attached.
     77 * @ exit_vallue  : [in] pointer to be returned to parent thread if thread is attached.
    7578 * @ return 0 if success / return -1 if failure.
    7679 ********************************************************************************************/
     
    8588int pthread_yield( void );
    8689
    87 //////////////////////////////////////////////////////////////////////////////////////////////
    88 //                 POSIX Barriers related functions
     90
     91//////////////////////////////////////////////////////////////////////////////////////////////
     92//                 POSIX barrier related functions
    8993//
    9094// These functions are implemented in user space. Only the pthread_barrier_init() function
    91 // uses syscalls to build the distributed quad-tree infrastructure.
     95// uses system calls to build the distributed quad-tree infrastructure.
    9296//////////////////////////////////////////////////////////////////////////////////////////////
    9397
     
    100104 *   . The involved clusters form a mesh [x_size * y_size]
    101105 *   . The lower left involved cluster is cluster(0,0) 
    102  *   . The number of threads in a cluster is the same in all clusters.
     106 *   . The number of threads per cluster is the same in all clusters.
    103107 *
    104108 * Implementation note:
     
    183187
    184188//////////////////////////////////////////////////////////////////////////////////////////////
    185 //                      POSIX Mutexes
    186 //
    187 // These functions are implemented in user space, and do not use syscalls.
    188 // This implementation uses a ticket based policy to enforce fairness.
    189 //////////////////////////////////////////////////////////////////////////////////////////////
    190 
    191 typedef struct pthread_mutex_s
    192 {
    193     volatile unsigned int current;   /*! current index                                      */
    194     volatile unsigned int free;      /*! next free ticket index                             */
    195 }
    196 pthread_mutex_t;
    197 
    198 typedef struct pthread_mutexattr_s
    199 {
    200     int          bloup;              /*! unused                                             */
    201 }
    202 pthread_mutexattr_t;
     189//                      POSIX mutex related functions
     190//////////////////////////////////////////////////////////////////////////////////////////////
    203191
    204192/*********************************************************************************************
     
    231219
    232220/*********************************************************************************************
     221 * This function unlocks the mutex identified by the <mutex> argument.
     222 *********************************************************************************************
     223 * @ mutex     : pointer on mutex in user space.
     224 * @ return 0 if success / return -1 if failure.
     225 ********************************************************************************************/
     226int pthread_mutex_unlock( pthread_mutex_t * mutex );
     227
     228/*********************************************************************************************
    233229 * This function tries to lock the mutex identified by the <mutex> argument,
    234230 * but don't block if the mutex is locked by another thread, including the current thread.
     
    239235int pthread_mutex_trylock( pthread_mutex_t * mutex );
    240236
    241 /*********************************************************************************************
    242  * This function unlocks the mutex identified by the <mutex> argument.
    243  *********************************************************************************************
    244  * @ mutex     : pointer on mutex in user space.
    245  * @ return 0 if success / return -1 if failure.
    246  ********************************************************************************************/
    247 int pthread_mutex_unlock( pthread_mutex_t * mutex );
     237
     238//////////////////////////////////////////////////////////////////////////////////////////////
     239//                      POSIX condvar related functions
     240//////////////////////////////////////////////////////////////////////////////////////////////
     241
     242/*********************************************************************************************
     243 * This function initializes a condition variable identified by the <cond> argument.
     244 * WARNING: the <attr> argument is not supported and must be NULL.
     245 *********************************************************************************************
     246 * @ cond   : [in] pointer on condition in user space.
     247 * @ attr   : [in] pointer on condition attribute (must be NULL).
     248 * @ return 0 if success / return -1 if failure.
     249 ********************************************************************************************/
     250int pthread_cond_init( pthread_cond_t     * cond,
     251                       pthread_condattr_t * attr );
     252
     253/*********************************************************************************************
     254 * This function atomically unlocks the <mutex> and blocks the calling thread on the
     255 * condition specified by the <cond> argument.  The thread unblocks only after another
     256 * thread calls the pthread_cond_signal() or pthread_cond_broadcast() functions with the
     257 * same condition variable.  The mutex must be locked before calling this function,
     258 * otherwise the behavior is undefined. Before the pthread_cond_wait() function returns
     259 * to the calling function, it re-acquires the <mutex>.
     260 *********************************************************************************************
     261 * @ cond      : pointer on condition in user space.
     262 * @ mutex     : pointer on mutex in user space.
     263 * @ return 0 if success / return -1 if failure.
     264 ********************************************************************************************/
     265int pthread_cond_wait( pthread_cond_t  * cond,
     266                       pthread_mutex_t * mutex );
     267
     268/*********************************************************************************************
     269 * This function unblocks one thread blocked on condition specified by the <cond> argument.
     270 *********************************************************************************************
     271 * @ cond      : pointer on condition in user space.
     272 * @ return 0 if success / return -1 if failure.
     273 ********************************************************************************************/
     274int pthread_cond_signal( pthread_cond_t * cond );
     275
     276/*********************************************************************************************
     277 * This function unblocks all threads blocked on condition specified by the <cond> argument.
     278 *********************************************************************************************
     279 * @ cond      : pointer on condition in user space.
     280 * @ return 0 if success / return -1 if failure.
     281 ********************************************************************************************/
     282int pthread_cond_broadcast( pthread_cond_t * cond );
     283
     284/*********************************************************************************************
     285 * This function delete the condition variable specified by the <cond> argument.
     286 *********************************************************************************************
     287 * @ cond      : pointer on condition in user space.
     288 * @ return 0 if success / return -1 if failure.
     289 ********************************************************************************************/
     290int pthread_cond_destroy( pthread_cond_t * cond );
     291
    248292
    249293
Note: See TracChangeset for help on using the changeset viewer.