RetroArch
pthread.h
Go to the documentation of this file.
1 /* This is an implementation of the threads API of POSIX 1003.1-2001.
2  *
3  * --------------------------------------------------------------------------
4  *
5  * Pthreads-embedded (PTE) - POSIX Threads Library for embedded systems
6  * Copyright(C) 2008 Jason Schmidlapp
7  *
8  * Contact Email: jschmidlapp@users.sourceforge.net
9  *
10  *
11  * Pthreads-embedded (PTE) - POSIX Threads Library for embedded systems
12  * Copyright(C) 2008 Jason Schmidlapp
13  *
14  * Contact Email: jschmidlapp@users.sourceforge.net
15  *
16  *
17  * Based upon Pthreads-win32 - POSIX Threads Library for Win32
18  * Copyright(C) 1998 John E. Bossom
19  * Copyright(C) 1999,2005 Pthreads-win32 contributors
20  *
21  * Contact Email: rpj@callisto.canberra.edu.au
22  *
23  * The original list of contributors to the Pthreads-win32 project
24  * is contained in the file CONTRIBUTORS.ptw32 included with the
25  * source code distribution. The list can also be seen at the
26  * following World Wide Web location:
27  * http://sources.redhat.com/pthreads-win32/contributors.html
28  *
29  * This library is free software; you can redistribute it and/or
30  * modify it under the terms of the GNU Lesser General Public
31  * License as published by the Free Software Foundation; either
32  * version 2 of the License, or (at your option) any later version.
33  *
34  * This library is distributed in the hope that it will be useful,
35  * but WITHOUT ANY WARRANTY; without even the implied warranty of
36  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
37  * Lesser General Public License for more details.
38  *
39  * You should have received a copy of the GNU Lesser General Public
40  * License along with this library in the file COPYING.LIB;
41  * if not, write to the Free Software Foundation, Inc.,
42  * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
43  */
44 #if !defined( PTHREAD_H )
45 #define PTHREAD_H
46 
47 #include <pte_types.h>
48 
49 #include <sched.h>
50 
51 #define PTE_VERSION 2,8,0,0
52 #define PTE_VERSION_STRING "2, 8, 0, 0\0"
53 
54 /* There are two implementations of cancel cleanup.
55  * Note that pthread.h is included in both application
56  * compilation units and also internally for the library.
57  * The code here and within the library aims to work
58  * for all reasonable combinations of environments.
59  *
60  * The two implementations are:
61  *
62  * C
63  * C++
64  *
65  */
66 
67 /*
68  * Define defaults for cleanup code.
69  * Note: Unless the build explicitly defines one of the following, then
70  * we default to standard C style cleanup. This style uses setjmp/longjmp
71  * in the cancelation and thread exit implementations and therefore won't
72  * do stack unwinding if linked to applications that have it (e.g.
73  * C++ apps). This is currently consistent with most/all commercial Unix
74  * POSIX threads implementations.
75  */
76 
77 #undef PTE_LEVEL
78 
79 #if defined(_POSIX_SOURCE)
80 #define PTE_LEVEL 0
81 /* Early POSIX */
82 #endif
83 
84 #if defined(_POSIX_C_SOURCE) && _POSIX_C_SOURCE >= 199309
85 #undef PTE_LEVEL
86 #define PTE_LEVEL 1
87 /* Include 1b, 1c and 1d */
88 #endif
89 
90 #if defined(INCLUDE_NP)
91 #undef PTE_LEVEL
92 #define PTE_LEVEL 2
93 /* Include Non-Portable extensions */
94 #endif
95 
96 #define PTE_LEVEL_MAX 3
97 
98 #if !defined(PTE_LEVEL)
99 #define PTE_LEVEL PTE_LEVEL_MAX
100 /* Include everything */
101 #endif
102 
103 /*
104  * -------------------------------------------------------------
105  *
106  *
107  * Module: pthread.h
108  *
109  * Purpose:
110  * Provides an implementation of PThreads based upon the
111  * standard:
112  *
113  * POSIX 1003.1-2001
114  * and
115  * The Single Unix Specification version 3
116  *
117  * (these two are equivalent)
118  *
119  * in order to enhance code portability between Windows,
120  * various commercial Unix implementations, and Linux.
121  *
122  * See the ANNOUNCE file for a full list of conforming
123  * routines and defined constants, and a list of missing
124  * routines and constants not defined in this implementation.
125  *
126  * Authors:
127  * There have been many contributors to this library.
128  * The initial implementation was contributed by
129  * John Bossom, and several others have provided major
130  * sections or revisions of parts of the implementation.
131  * Often significant effort has been contributed to
132  * find and fix important bugs and other problems to
133  * improve the reliability of the library, which sometimes
134  * is not reflected in the amount of code which changed as
135  * result.
136  * As much as possible, the contributors are acknowledged
137  * in the ChangeLog file in the source code distribution
138  * where their changes are noted in detail.
139  *
140  * Contributors are listed in the CONTRIBUTORS file.
141  *
142  * As usual, all bouquets go to the contributors, and all
143  * brickbats go to the project maintainer.
144  *
145  * Maintainer:
146  * The code base for this project is coordinated and
147  * eventually pre-tested, packaged, and made available by
148  *
149  * Ross Johnson <rpj@callisto.canberra.edu.au>
150  *
151  * QA Testers:
152  * Ultimately, the library is tested in the real world by
153  * a host of competent and demanding scientists and
154  * engineers who report bugs and/or provide solutions
155  * which are then fixed or incorporated into subsequent
156  * versions of the library. Each time a bug is fixed, a
157  * test case is written to prove the fix and ensure
158  * that later changes to the code don't reintroduce the
159  * same error. The number of test cases is slowly growing
160  * and therefore so is the code reliability.
161  *
162  * Compliance:
163  * See the file ANNOUNCE for the list of implemented
164  * and not-implemented routines and defined options.
165  * Of course, these are all defined is this file as well.
166  *
167  * Web site:
168  * The source code and other information about this library
169  * are available from
170  *
171  * http://sources.redhat.com/pthreads-win32/
172  *
173  * -------------------------------------------------------------
174  */
175 
176 #include <time.h>
177 
178 #include <setjmp.h>
179 #include <limits.h>
180 
181 /*
182  * Boolean values to make us independent of system includes.
183  */
184 enum
185 {
188 };
189 
190 
191  /*
192  * -------------------------------------------------------------
193  *
194  * POSIX 1003.1-2001 Options
195  * =========================
196  *
197  * Options are normally set in <unistd.h>, which is not provided
198  * with pthreads-embedded.
199  *
200  * For conformance with the Single Unix Specification (version 3), all of the
201  * options below are defined, and have a value of either -1 (not supported)
202  * or 200112L (supported).
203  *
204  * These options can neither be left undefined nor have a value of 0, because
205  * either indicates that sysconf(), which is not implemented, may be used at
206  * runtime to check the status of the option.
207  *
208  * _POSIX_THREADS (== 200112L)
209  * If == 200112L, you can use threads
210  *
211  * _POSIX_THREAD_ATTR_STACKSIZE (== 200112L)
212  * If == 200112L, you can control the size of a thread's
213  * stack
214  * pthread_attr_getstacksize
215  * pthread_attr_setstacksize
216  *
217  * _POSIX_THREAD_ATTR_STACKADDR (== -1)
218  * If == 200112L, you can allocate and control a thread's
219  * stack. If not supported, the following functions
220  * will return ENOSYS, indicating they are not
221  * supported:
222  * pthread_attr_getstackaddr
223  * pthread_attr_setstackaddr
224  *
225  * _POSIX_THREAD_PRIORITY_SCHEDULING (== -1)
226  * If == 200112L, you can use realtime scheduling.
227  * This option indicates that the behaviour of some
228  * implemented functions conforms to the additional TPS
229  * requirements in the standard. E.g. rwlocks favour
230  * writers over readers when threads have equal priority.
231  *
232  * _POSIX_THREAD_PRIO_INHERIT (== -1)
233  * If == 200112L, you can create priority inheritance
234  * mutexes.
235  * pthread_mutexattr_getprotocol +
236  * pthread_mutexattr_setprotocol +
237  *
238  * _POSIX_THREAD_PRIO_PROTECT (== -1)
239  * If == 200112L, you can create priority ceiling mutexes
240  * Indicates the availability of:
241  * pthread_mutex_getprioceiling
242  * pthread_mutex_setprioceiling
243  * pthread_mutexattr_getprioceiling
244  * pthread_mutexattr_getprotocol +
245  * pthread_mutexattr_setprioceiling
246  * pthread_mutexattr_setprotocol +
247  *
248  * _POSIX_THREAD_PROCESS_SHARED (== -1)
249  * If set, you can create mutexes and condition
250  * variables that can be shared with another
251  * process.If set, indicates the availability
252  * of:
253  * pthread_mutexattr_getpshared
254  * pthread_mutexattr_setpshared
255  * pthread_condattr_getpshared
256  * pthread_condattr_setpshared
257  *
258  * _POSIX_THREAD_SAFE_FUNCTIONS (== 200112L)
259  * If == 200112L you can use the special *_r library
260  * functions that provide thread-safe behaviour
261  *
262  * _POSIX_READER_WRITER_LOCKS (== 200112L)
263  * If == 200112L, you can use read/write locks
264  *
265  * _POSIX_SPIN_LOCKS (== 200112L)
266  * If == 200112L, you can use spin locks
267  *
268  * _POSIX_BARRIERS (== 200112L)
269  * If == 200112L, you can use barriers
270  *
271  * + These functions provide both 'inherit' and/or
272  * 'protect' protocol, based upon these macro
273  * settings.
274  *
275  * -------------------------------------------------------------
276  */
277 
278  /*
279  * POSIX Options
280  */
281 #undef _POSIX_THREADS
282 #define _POSIX_THREADS 200112L
283 
284 #undef _POSIX_READER_WRITER_LOCKS
285 #define _POSIX_READER_WRITER_LOCKS 200112L
286 
287 #undef _POSIX_SPIN_LOCKS
288 #define _POSIX_SPIN_LOCKS 200112L
289 
290 #undef _POSIX_BARRIERS
291 #define _POSIX_BARRIERS 200112L
292 
293 #undef _POSIX_THREAD_SAFE_FUNCTIONS
294 #define _POSIX_THREAD_SAFE_FUNCTIONS 200112L
295 
296 #undef _POSIX_THREAD_ATTR_STACKSIZE
297 #define _POSIX_THREAD_ATTR_STACKSIZE 200112L
298 
299  /*
300  * The following options are not supported
301  */
302 #undef _POSIX_THREAD_ATTR_STACKADDR
303 #define _POSIX_THREAD_ATTR_STACKADDR -1
304 
305 #undef _POSIX_THREAD_PRIO_INHERIT
306 #define _POSIX_THREAD_PRIO_INHERIT -1
307 
308 #undef _POSIX_THREAD_PRIO_PROTECT
309 #define _POSIX_THREAD_PRIO_PROTECT -1
310 
311  /* TPS is not fully supported. */
312 #undef _POSIX_THREAD_PRIORITY_SCHEDULING
313 #define _POSIX_THREAD_PRIORITY_SCHEDULING -1
314 
315 #undef _POSIX_THREAD_PROCESS_SHARED
316 #define _POSIX_THREAD_PROCESS_SHARED -1
317 
318 
319  /*
320  * POSIX 1003.1-2001 Limits
321  * ===========================
322  *
323  * These limits are normally set in <limits.h>, which is not provided with
324  * pthreads-embedded.
325  *
326  * PTHREAD_DESTRUCTOR_ITERATIONS
327  * Maximum number of attempts to destroy
328  * a thread's thread-specific data on
329  * termination (must be at least 4)
330  *
331  * PTHREAD_KEYS_MAX
332  * Maximum number of thread-specific data keys
333  * available per process (must be at least 128)
334  *
335  * PTHREAD_STACK_MIN
336  * Minimum supported stack size for a thread
337  *
338  * PTHREAD_THREADS_MAX
339  * Maximum number of threads supported per
340  * process (must be at least 64).
341  *
342  * SEM_NSEMS_MAX
343  * The maximum number of semaphores a process can have.
344  * (must be at least 256)
345  *
346  * SEM_VALUE_MAX
347  * The maximum value a semaphore can have.
348  * (must be at least 32767)
349  *
350  */
351 #undef _POSIX_THREAD_DESTRUCTOR_ITERATIONS
352 #define _POSIX_THREAD_DESTRUCTOR_ITERATIONS 4
353 
354 #undef PTHREAD_DESTRUCTOR_ITERATIONS
355 #define PTHREAD_DESTRUCTOR_ITERATIONS _POSIX_THREAD_DESTRUCTOR_ITERATIONS
356 
357 #undef _POSIX_THREAD_KEYS_MAX
358 #define _POSIX_THREAD_KEYS_MAX 128
359 
360 #undef PTHREAD_KEYS_MAX
361 #define PTHREAD_KEYS_MAX _POSIX_THREAD_KEYS_MAX
362 
363 #undef PTHREAD_STACK_MIN
364 #define PTHREAD_STACK_MIN 0
365 
366 #undef _POSIX_THREAD_THREADS_MAX
367 #define _POSIX_THREAD_THREADS_MAX 64
368 
369  /* Arbitrary value */
370 #undef PTHREAD_THREADS_MAX
371 #define PTHREAD_THREADS_MAX 2019
372 
373 #undef _POSIX_SEM_NSEMS_MAX
374 #define _POSIX_SEM_NSEMS_MAX 256
375 
376  /* Arbitrary value */
377 #undef SEM_NSEMS_MAX
378 #define SEM_NSEMS_MAX 1024
379 
380 #undef _POSIX_SEM_VALUE_MAX
381 #define _POSIX_SEM_VALUE_MAX 32767
382 
383 #undef SEM_VALUE_MAX
384 #define SEM_VALUE_MAX INT_MAX
385 
386 
387  /*
388  * Generic handle type - intended to extend uniqueness beyond
389  * that available with a simple pointer. It should scale for either
390  * IA-32 or IA-64.
391  */
392  typedef struct
393  {
394  void * p; /* Pointer to actual object */
395  unsigned int x; /* Extra information - reuse count etc */
396  } pte_handle_t;
397 
398  typedef /* pte_handle_t */ void * pthread_t;
399  typedef struct pthread_attr_t_ * pthread_attr_t;
401  typedef struct pthread_key_t_ * pthread_key_t;
404  typedef struct pthread_cond_t_ * pthread_cond_t;
411 
412  /*
413  * ====================
414  * ====================
415  * POSIX Threads
416  * ====================
417  * ====================
418  */
419 
420  enum
421  {
422  /*
423  * pthread_attr_{get,set}detachstate
424  */
425  PTHREAD_CREATE_JOINABLE = 0, /* Default */
427 
428  /*
429  * pthread_attr_{get,set}inheritsched
430  */
432  PTHREAD_EXPLICIT_SCHED = 1, /* Default */
433 
434  /*
435  * pthread_{get,set}scope
436  */
438  PTHREAD_SCOPE_SYSTEM = 1, /* Default */
439  PTHREAD_SCOPE_PROCESS_VFPU = 2, /* PSP specific */
440 
441  /*
442  * pthread_setcancelstate paramters
443  */
444  PTHREAD_CANCEL_ENABLE = 0, /* Default */
446 
447  /*
448  * pthread_setcanceltype parameters
449  */
451  PTHREAD_CANCEL_DEFERRED = 1, /* Default */
452 
453  /*
454  * pthread_mutexattr_{get,set}pshared
455  * pthread_condattr_{get,set}pshared
456  */
459 
460  /*
461  * pthread_barrier_wait
462  */
464  };
465 
466  /*
467  * ====================
468  * ====================
469  * Cancelation
470  * ====================
471  * ====================
472  */
473 #define PTHREAD_CANCELED ((void *) -1)
474 
475 
476  /*
477  * ====================
478  * ====================
479  * Once Key
480  * ====================
481  * ====================
482  */
483 #define PTHREAD_ONCE_INIT { PTE_FALSE, 0, 0, 0}
484 
486  {
487  int state;
488  void * semaphore;
490  int done; /* indicates if user function has been executed */
491 // void * lock;
492 // int reserved1;
493 // int reserved2;
494  };
495 
496 
497  /*
498  * ====================
499  * ====================
500  * Object initialisers
501  * ====================
502  * ====================
503  */
504 #define PTHREAD_MUTEX_INITIALIZER ((pthread_mutex_t) -1)
505 #define PTHREAD_RECURSIVE_MUTEX_INITIALIZER ((pthread_mutex_t) -2)
506 #define PTHREAD_ERRORCHECK_MUTEX_INITIALIZER ((pthread_mutex_t) -3)
507 
508  /*
509  * Compatibility with LinuxThreads
510  */
511 #define PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP PTHREAD_RECURSIVE_MUTEX_INITIALIZER
512 #define PTHREAD_ERRORCHECK_MUTEX_INITIALIZER_NP PTHREAD_ERRORCHECK_MUTEX_INITIALIZER
513 
514 #define PTHREAD_COND_INITIALIZER ((pthread_cond_t) -1)
515 
516 #define PTHREAD_RWLOCK_INITIALIZER ((pthread_rwlock_t) -1)
517 
518 #define PTHREAD_SPINLOCK_INITIALIZER ((pthread_spinlock_t) -1)
519 
520 /*
521  * Mutex types.
522  */
523 enum
524 {
525  /* Compatibility with LinuxThreads */
531  /* For compatibility with POSIX */
536 };
537 
538 
540 
541 typedef void (* pte_cleanup_callback_t)(void *);
542 
544 {
546  void *arg;
548 };
549 
550 /*
551  * C implementation of PThreads cancel cleanup
552  */
553 
554 #define pthread_cleanup_push( _rout, _arg ) \
555 { \
556  pte_cleanup_t _cleanup; \
557  \
558  pte_push_cleanup( &_cleanup, (pte_cleanup_callback_t) (_rout), (_arg) ); \
559 
560 #define pthread_cleanup_pop( _execute ) \
561  (void) pte_pop_cleanup( _execute ); \
562 }
563 
564 #ifdef __cplusplus
565 extern "C" {
566 #endif /* __cplusplus */
567 
568  /*
569  * ===============
570  * ===============
571  * Methods
572  * ===============
573  * ===============
574  */
575 
576  int pthread_init (void);
577  void pthread_terminate (void);
578 
579  /*
580  * PThread Attribute Functions
581  */
582  int pthread_attr_init (pthread_attr_t * attr);
583 
585 
587  int *detachstate);
588 
589  int pthread_attr_getstackaddr (const pthread_attr_t * attr,
590  void **stackaddr);
591 
592  int pthread_attr_getstacksize (const pthread_attr_t * attr,
593  size_t * stacksize);
594 
596  int detachstate);
597 
599  void *stackaddr);
600 
602  size_t stacksize);
603 
605  struct sched_param *param);
606 
608  const struct sched_param *param);
609 
611  int);
612 
614  int *);
615 
617  int inheritsched);
618 
620  int * inheritsched);
621 
623  int);
624 
626  int *);
627 
628  /*
629  * PThread Functions
630  */
631  int pthread_create (pthread_t * tid,
632  const pthread_attr_t * attr,
633  void *(*start) (void *),
634  void *arg);
635 
636  int pthread_detach (pthread_t tid);
637 
638  int pthread_equal (pthread_t t1,
639  pthread_t t2);
640 
641  void pthread_exit (void *value_ptr);
642 
643  int pthread_join (pthread_t thread,
644  void **value_ptr);
645 
646  pthread_t pthread_self (void);
647 
648  int pthread_cancel (pthread_t thread);
649 
650  int pthread_setcancelstate (int state,
651  int *oldstate);
652 
653  int pthread_setcanceltype (int type,
654  int *oldtype);
655 
656  void pthread_testcancel (void);
657 
658  int pthread_once (pthread_once_t * once_control,
659  void (*init_routine) (void));
660 
661 #if PTE_LEVEL >= PTE_LEVEL_MAX
662  pte_cleanup_t * pte_pop_cleanup (int execute);
663 
665  void (*routine) (void *),
666  void *arg);
667 #endif /* PTE_LEVEL >= PTE_LEVEL_MAX */
668 
669  /*
670  * Thread Specific Data Functions
671  */
673  void (*destructor) (void *));
674 
676 
678  const void *value);
679 
680  void * pthread_getspecific (pthread_key_t key);
681 
682 
683  /*
684  * Mutex Attribute Functions
685  */
687 
689 
691  * attr,
692  int *pshared);
693 
695  int pshared);
696 
697  int pthread_mutexattr_settype (pthread_mutexattr_t * attr, int kind);
698  int pthread_mutexattr_gettype (pthread_mutexattr_t * attr, int *kind);
699 
700  /*
701  * Barrier Attribute Functions
702  */
704 
706 
708  * attr,
709  int *pshared);
710 
712  int pshared);
713 
714  /*
715  * Mutex Functions
716  */
718  const pthread_mutexattr_t * attr);
719 
721 
723 
725  const struct timespec *abstime);
726 
728 
730 
731  /*
732  * Spinlock Functions
733  */
734  int pthread_spin_init (pthread_spinlock_t * lock, int pshared);
735 
737 
739 
741 
743 
744  /*
745  * Barrier Functions
746  */
748  const pthread_barrierattr_t * attr,
749  unsigned int count);
750 
752 
754 
755  /*
756  * Condition Variable Attribute Functions
757  */
759 
761 
763  int *pshared);
764 
766  int pshared);
767 
768  /*
769  * Condition Variable Functions
770  */
772  const pthread_condattr_t * attr);
773 
775 
778 
781  const struct timespec *abstime);
782 
784 
786 
787  /*
788  * Scheduling
789  */
790  int pthread_setschedparam (pthread_t thread,
791  int policy,
792  const struct sched_param *param);
793 
794  int pthread_getschedparam (pthread_t thread,
795  int *policy,
796  struct sched_param *param);
797 
798  int pthread_setconcurrency (int);
799 
800  int pthread_getconcurrency (void);
801 
802  /*
803  * Read-Write Lock Functions
804  */
806  const pthread_rwlockattr_t *attr);
807 
809 
811 
813 
815 
817  const struct timespec *abstime);
818 
820 
822  const struct timespec *abstime);
823 
825 
827 
829 
831  int *pshared);
832 
834  int pshared);
835 
836 #if PTE_LEVEL >= PTE_LEVEL_MAX - 1
837 
838  /*
839  * Signal Functions. Should be defined in <signal.h> but we might
840  * already have signal.h that don't define these.
841  */
842  int pthread_kill(pthread_t thread, int sig);
843 
844  /*
845  * Non-portable functions
846  */
847 
848  /*
849  * Compatibility with Linux.
850  */
852  int kind);
854  int *kind);
855 
856  /*
857  * Possibly supported by other POSIX threads implementations
858  */
859  int pthread_delay_np (struct timespec * interval);
860  int pthread_num_processors_np(void);
861 
862  /*
863  * Register a system time change with the library.
864  * Causes the library to perform various functions
865  * in response to the change. Should be called whenever
866  * the application's top level window receives a
867  * WM_TIMECHANGE message. It can be passed directly to
868  * pthread_create() as a new thread if desired.
869  */
870  void * pthread_timechange_handler_np(void *);
871 
872 #endif /*PTE_LEVEL >= PTE_LEVEL_MAX - 1 */
873 
874 #ifdef __cplusplus
875 }
876 #endif /* cplusplus */
877 
878 #if PTE_LEVEL >= PTE_LEVEL_MAX
879 
880 #endif /* PTE_LEVEL >= PTE_LEVEL_MAX */
881 
882 /*
883  * Some compiler environments don't define some things.
884  */
885 # define _ftime ftime
886 # define _timeb timeb
887 
888 #undef PTE_LEVEL
889 #undef PTE_LEVEL_MAX
890 
891 #endif /* PTHREAD_H */
int pthread_setschedparam(pthread_t thread, int policy, const struct sched_param *param)
Definition: pthread_set.c:225
int pthread_kill(pthread_t thread, int sig)
Definition: pthread.c:952
int pthread_cancel(pthread_t thread)
Definition: pthread.c:300
Definition: implement.h:269
int pthread_key_create(pthread_key_t *key, void(*destructor)(void *))
Definition: pthread_key.c:53
Definition: implement.h:233
int pthread_cond_broadcast(pthread_cond_t *cond)
Definition: pthread_cond.c:658
Definition: pthread.h:186
int pthread_mutexattr_settype(pthread_mutexattr_t *attr, int kind)
Definition: pthread_mutexattr.c:278
Definition: pthread.h:529
int pthread_attr_setschedpolicy(pthread_attr_t *, int)
Definition: pthread_attr.c:434
int pthread_attr_setscope(pthread_attr_t *, int)
Definition: pthread_attr.c:445
Definition: pthread.h:528
Definition: sched.h:97
int pthread_attr_setstackaddr(pthread_attr_t *attr, void *stackaddr)
Definition: pthread_attr.c:463
struct pte_cleanup_t * prev
Definition: pthread.h:547
struct pthread_barrier_t_ * pthread_barrier_t
Definition: pthread.h:409
Definition: pthread.h:485
void(* pte_cleanup_callback_t)(void *)
Definition: pthread.h:541
int pthread_rwlockattr_init(pthread_rwlockattr_t *attr)
Definition: pthread_rwlockattr.c:148
GLuint start
Definition: glext.h:6292
struct pthread_key_t_ * pthread_key_t
Definition: pthread.h:401
int pthread_barrier_destroy(pthread_barrier_t *barrier)
Definition: pthread_barrier.c:48
Definition: pthread.h:532
Definition: pthread.h:445
Definition: pthread.h:439
struct pthread_cond_t_ * pthread_cond_t
Definition: pthread.h:404
Definition: pthread.h:530
void * pthread_timechange_handler_np(void *)
Definition: pthread.c:908
void pte_push_cleanup(pte_cleanup_t *cleanup, void(*routine)(void *), void *arg)
Definition: pte_main.c:348
struct pthread_mutexattr_t_ * pthread_mutexattr_t
Definition: pthread.h:403
int pthread_spin_init(pthread_spinlock_t *lock, int pshared)
Definition: pthread_spin.c:122
int pthread_rwlock_rdlock(pthread_rwlock_t *lock)
Definition: pthread_rwlock.c:209
int pthread_getconcurrency(void)
Definition: pthread_get.c:47
static int cond(LexState *ls)
Definition: lparser.c:1177
int pthread_attr_getscope(const pthread_attr_t *, int *)
Definition: pthread_attr.c:171
pte_cleanup_callback_t routine
Definition: pthread.h:545
Definition: pthread.h:535
int pthread_rwlock_tryrdlock(pthread_rwlock_t *)
Definition: pthread_rwlock.c:416
Definition: pthread.h:463
int pthread_mutexattr_gettype(pthread_mutexattr_t *attr, int *kind)
Definition: pthread_mutexattr.c:94
int pthread_barrier_init(pthread_barrier_t *barrier, const pthread_barrierattr_t *attr, unsigned int count)
Definition: pthread_barrier.c:73
typedef void(__stdcall *PFN_DESTRUCTION_CALLBACK)(void *pData)
int pthread_spin_trylock(pthread_spinlock_t *lock)
Definition: pthread_spin.c:236
int pthread_mutex_init(pthread_mutex_t *mutex, const pthread_mutexattr_t *attr)
Definition: pthread_mutex.c:158
int pthread_condattr_setpshared(pthread_condattr_t *attr, int pshared)
Definition: pthread_condattr.c:189
static sys_sem mutex
Definition: memp.c:120
void pthread_testcancel(void)
Definition: pthread.c:67
set set set set set set set macro pixldst1 abits if abits op else op endif endm macro pixldst2 abits if abits op else op endif endm macro pixldst4 abits if abits op else op endif endm macro pixldst0 abits op endm macro pixldst3 mem_operand op endm macro pixldst30 mem_operand op endm macro pixldst abits if abits elseif abits elseif abits elseif abits elseif abits pixldst0 abits else pixldst0 abits pixldst0 abits pixldst0 abits pixldst0 abits endif elseif abits else pixldst0 abits pixldst0 abits endif elseif abits else error unsupported bpp *numpix else pixst endif endm macro pixld1_s mem_operand if asr adds SRC_WIDTH_FIXED bpl add asl mov asr adds SRC_WIDTH_FIXED bpl add asl mov asr adds SRC_WIDTH_FIXED bpl add asl mov asr adds SRC_WIDTH_FIXED bpl add asl elseif asr adds SRC_WIDTH_FIXED bpl add asl mov asr adds SRC_WIDTH_FIXED bpl add asl else error unsupported endif endm macro pixld2_s mem_operand if mov asr add asl add asl mov asr sub UNIT_X add asl mov asr add asl add asl mov asr add UNIT_X add asl else pixld1_s mem_operand pixld1_s mem_operand endif endm macro pixld0_s mem_operand if asr adds SRC_WIDTH_FIXED bpl add asl elseif asr adds SRC_WIDTH_FIXED bpl add asl endif endm macro pixld_s_internal mem_operand if mem_operand pixld2_s mem_operand pixdeinterleave basereg elseif mem_operand elseif mem_operand elseif mem_operand elseif mem_operand pixld0_s mem_operand else pixld0_s mem_operand pixld0_s mem_operand pixld0_s mem_operand pixld0_s mem_operand endif elseif mem_operand else pixld0_s mem_operand pixld0_s mem_operand endif elseif mem_operand else error unsupported mem_operand if bpp mem_operand endif endm macro vuzp8 reg2 vuzp d d &reg2 endm macro vzip8 reg2 vzip d d &reg2 endm macro pixdeinterleave basereg basereg basereg basereg basereg endif endm macro pixinterleave basereg basereg basereg basereg basereg endif endm macro PF boost_increment endif if endif PF tst PF addne PF subne PF cmp ORIG_W if endif if endif if endif PF subge ORIG_W PF subges if endif if endif if endif endif endm macro cache_preload_simple endif if dst_r_bpp pld [DST_R, #(PREFETCH_DISTANCE_SIMPLE *dst_r_bpp/8)] endif if mask_bpp pld cleanup[MASK, #(PREFETCH_DISTANCE_SIMPLE *mask_bpp/8)] endif endif endm macro fetch_mask_pixblock pixld mask_basereg pixblock_size MASK endm macro ensure_destination_ptr_alignment process_pixblock_tail_head if beq irp local skip1 beq endif SRC MASK if dst_r_bpp DST_R else add endif PF add sub src_basereg pixdeinterleave mask_basereg pixdeinterleave dst_r_basereg process_pixblock_head pixblock_size cache_preload_simple process_pixblock_tail pixinterleave dst_w_basereg irp beq endif process_pixblock_tail_head tst beq irp if pixblock_size chunk_size tst beq pixld_src SRC pixld MASK if DST_R else pixld DST_R endif if src_basereg pixdeinterleave mask_basereg pixdeinterleave dst_r_basereg process_pixblock_head if pixblock_size cache_preload_simple endif process_pixblock_tail pixinterleave dst_w_basereg irp if pixblock_size chunk_size tst beq if DST_W else pixst DST_W else mov ORIG_W endif add lsl if lsl endif if lsl endif lsl endif lsl endif lsl endif subs mov DST_W if regs_shortage str endif bge start_of_loop_label endm macro generate_composite_function
Definition: pixman-arm-neon-asm.h:600
Definition: pthread.h:526
GLuint GLuint GLsizei count
Definition: glext.h:6292
int pthread_barrierattr_init(pthread_barrierattr_t *attr)
Definition: pthread_barrierattr.c:145
int pthread_equal(pthread_t t1, pthread_t t2)
Definition: pthread.c:615
Definition: pthread.h:187
int pthread_mutex_timedlock(pthread_mutex_t *mutex, const struct timespec *abstime)
Definition: pthread_mutex.c:323
Definition: pthread.h:457
int pthread_attr_getdetachstate(const pthread_attr_t *attr, int *detachstate)
Definition: pthread_attr.c:88
int pthread_mutexattr_destroy(pthread_mutexattr_t *attr)
Definition: pthread_mutexattr.c:48
GLfloat param
Definition: glext.h:6480
int pthread_create(pthread_t *tid, const pthread_attr_t *attr, void *(*start)(void *), void *arg)
Definition: pte_main.c:103
int pthread_key_delete(pthread_key_t key)
Definition: pthread_key.c:120
int pthread_rwlockattr_destroy(pthread_rwlockattr_t *attr)
Definition: pthread_rwlockattr.c:51
GLenum type
Definition: glext.h:6233
int pthread_condattr_init(pthread_condattr_t *attr)
Definition: pthread_condattr.c:146
int pthread_mutex_lock(pthread_mutex_t *mutex)
Definition: pthread_mutex.c:187
int pthread_once(pthread_once_t *once_control, void(*init_routine)(void))
Definition: pthread.c:702
Definition: pthread.h:451
Definition: implement.h:146
int pthread_detach(pthread_t tid)
Definition: pthread.c:529
int pthread_barrierattr_destroy(pthread_barrierattr_t *attr)
Definition: pthread_barrierattr.c:50
int pthread_barrierattr_getpshared(const pthread_barrierattr_t *attr, int *pshared)
Definition: pthread_barrierattr.c:92
int pthread_rwlock_timedwrlock(pthread_rwlock_t *lock, const struct timespec *abstime)
Definition: pthread_rwlock.c:328
int pthread_attr_setstacksize(pthread_attr_t *attr, size_t stacksize)
Definition: pthread_attr.c:518
Definition: psp_pthread.h:45
int pthread_rwlockattr_getpshared(const pthread_rwlockattr_t *attr, int *pshared)
Definition: pthread_rwlockattr.c:95
int pthread_mutexattr_init(pthread_mutexattr_t *attr)
Definition: pthread_mutexattr.c:157
int pthread_rwlock_trywrlock(pthread_rwlock_t *)
Definition: pthread_rwlock.c:475
Definition: pthread.h:432
int pthread_attr_getstacksize(const pthread_attr_t *attr, size_t *stacksize)
Definition: pthread_attr.c:233
int done
Definition: pthread.h:490
void * p
Definition: pthread.h:394
int pthread_attr_init(pthread_attr_t *attr)
Definition: pthread_attr.c:286
Definition: implement.h:209
static uint64_t state[MAX_PADS]
Definition: xenon360_input.c:33
void * pthread_t
Definition: pthread.h:398
int pthread_mutexattr_getkind_np(pthread_mutexattr_t *attr, int *kind)
Definition: pthread_mutexattr.c:89
Definition: pthread.h:527
int state
Definition: pthread.h:487
int pthread_mutexattr_setpshared(pthread_mutexattr_t *attr, int pshared)
Definition: pthread_mutexattr.c:204
int pthread_attr_getstackaddr(const pthread_attr_t *attr, void **stackaddr)
Definition: pthread_attr.c:181
int pthread_cond_destroy(pthread_cond_t *cond)
Definition: pthread_cond.c:216
int pthread_attr_getschedpolicy(pthread_attr_t *, int *)
Definition: pthread_attr.c:154
Definition: pthread.h:444
pthread_t pthread_self(void)
Definition: pthread.c:817
void * arg
Definition: pthread.h:546
int pthread_setconcurrency(int)
Definition: pthread_set.c:216
struct pthread_spinlock_t_ * pthread_spinlock_t
Definition: pthread.h:408
Definition: implement.h:258
int pthread_getschedparam(pthread_t thread, int *policy, struct sched_param *param)
Definition: pthread_get.c:52
int pthread_attr_getschedparam(const pthread_attr_t *attr, struct sched_param *param)
Definition: pthread_attr.c:144
void pthread_exit(void *value_ptr)
Definition: pthread.c:648
int pthread_rwlock_unlock(pthread_rwlock_t *lock)
Definition: pthread_rwlock.c:554
int pthread_cond_timedwait(pthread_cond_t *cond, pthread_mutex_t *mutex, const struct timespec *abstime)
Definition: pthread_cond.c:753
int pthread_barrier_wait(pthread_barrier_t *barrier)
Definition: pthread_barrier.c:112
int pthread_rwlock_init(pthread_rwlock_t *lock, const pthread_rwlockattr_t *attr)
Definition: pthread_rwlock.c:143
int pthread_mutexattr_getpshared(const pthread_mutexattr_t *attr, int *pshared)
Definition: pthread_mutexattr.c:105
struct pthread_condattr_t_ * pthread_condattr_t
Definition: pthread.h:405
Definition: implement.h:190
int pthread_attr_destroy(pthread_attr_t *attr)
Definition: pthread_attr.c:51
int pthread_attr_setinheritsched(pthread_attr_t *attr, int inheritsched)
Definition: pthread_attr.c:400
int pthread_setcanceltype(int type, int *oldtype)
Definition: pthread_set.c:125
Definition: pthread.h:392
int pthread_condattr_destroy(pthread_condattr_t *attr)
Definition: pthread_condattr.c:51
int pthread_cond_wait(pthread_cond_t *cond, pthread_mutex_t *mutex)
Definition: pthread_cond.c:695
Definition: pthread.h:438
Definition: pthread.h:534
int pthread_mutexattr_setkind_np(pthread_mutexattr_t *attr, int kind)
Definition: pthread_mutexattr.c:199
int pthread_mutex_trylock(pthread_mutex_t *mutex)
Definition: pthread_mutex.c:393
int pthread_spin_lock(pthread_spinlock_t *lock)
Definition: pthread_spin.c:203
void * pthread_getspecific(pthread_key_t key)
Definition: pthread_get.c:83
struct pthread_mutex_t_ * pthread_mutex_t
Definition: pthread.h:402
unsigned int x
Definition: pthread.h:395
int pthread_num_processors_np(void)
Definition: pthread.c:1009
int pthread_join(pthread_t thread, void **value_ptr)
Definition: pthread.c:204
int pthread_cond_signal(pthread_cond_t *cond)
Definition: pthread_cond.c:616
int pthread_rwlockattr_setpshared(pthread_rwlockattr_t *attr, int pshared)
Definition: pthread_rwlockattr.c:186
int pthread_rwlock_timedrdlock(pthread_rwlock_t *lock, const struct timespec *abstime)
Definition: pthread_rwlock.c:262
Definition: implement.h:200
GLsizei const GLfloat * value
Definition: glext.h:6709
int pthread_init(void)
Definition: pthread.c:167
int pthread_spin_destroy(pthread_spinlock_t *lock)
Definition: pthread_spin.c:50
int pthread_spin_unlock(pthread_spinlock_t *lock)
Definition: pthread_spin.c:269
Definition: pthread.h:431
pte_cleanup_t * pte_pop_cleanup(int execute)
Definition: pte_main.c:299
Definition: implement.h:163
struct pthread_attr_t_ * pthread_attr_t
Definition: pthread.h:399
struct pthread_barrierattr_t_ * pthread_barrierattr_t
Definition: pthread.h:410
int pthread_attr_setschedparam(pthread_attr_t *attr, const struct sched_param *param)
Definition: pthread_attr.c:413
int pthread_delay_np(struct timespec *interval)
Definition: pthread.c:460
Definition: implement.h:116
int pthread_rwlock_destroy(pthread_rwlock_t *lock)
Definition: pthread_rwlock.c:50
int pthread_rwlock_wrlock(pthread_rwlock_t *lock)
Definition: pthread_rwlock.c:604
struct pthread_rwlock_t_ * pthread_rwlock_t
Definition: pthread.h:406
#define barrier()
Definition: internal_interface.hpp:494
Definition: pthread.h:458
Definition: pthread.h:437
int pthread_condattr_getpshared(const pthread_condattr_t *attr, int *pshared)
Definition: pthread_condattr.c:93
int pthread_attr_getinheritsched(pthread_attr_t *attr, int *inheritsched)
Definition: pthread_attr.c:135
int pthread_setcancelstate(int state, int *oldstate)
Definition: pthread_set.c:47
int pthread_barrierattr_setpshared(pthread_barrierattr_t *attr, int pshared)
Definition: pthread_barrierattr.c:184
int pthread_cond_init(pthread_cond_t *cond, const pthread_condattr_t *attr)
Definition: pthread_cond.c:403
Definition: implement.h:251
int pthread_mutex_destroy(pthread_mutex_t *mutex)
Definition: pthread_mutex.c:54
Definition: pthread.h:426
Definition: implement.h:214
Definition: pthread.h:533
void * semaphore
Definition: pthread.h:488
struct pthread_rwlockattr_t_ * pthread_rwlockattr_t
Definition: pthread.h:407
int pthread_attr_setdetachstate(pthread_attr_t *attr, int detachstate)
Definition: pthread_attr.c:353
int pthread_mutex_unlock(pthread_mutex_t *mutex)
Definition: pthread_mutex.c:436
Definition: pthread.h:450
Definition: pthread.h:425
Definition: pthread.h:543
void pthread_terminate(void)
Definition: pthread.c:124
int numSemaphoreUsers
Definition: pthread.h:489
int pthread_setspecific(pthread_key_t key, const void *value)
Definition: pthread_set.c:284