README.NONPORTABLE
上传用户:zhenyu
上传日期:2022-04-24
资源大小:268k
文件大小:12k
源码类别:

视频捕捉/采集

开发平台:

Visual C++

  1. This file documents non-portable functions and other issues.
  2. Non-portable functions included in pthreads-win32
  3. -------------------------------------------------
  4. BOOL
  5. pthread_win32_test_features_np(int mask)
  6. This routine allows an application to check which
  7. run-time auto-detected features are available within
  8. the library.
  9. The possible features are:
  10. PTW32_SYSTEM_INTERLOCKED_COMPARE_EXCHANGE
  11. Return TRUE if the native version of
  12. InterlockedCompareExchange() is being used.
  13. PTW32_ALERTABLE_ASYNC_CANCEL
  14. Return TRUE is the QueueUserAPCEx package
  15. QUSEREX.DLL is available and the AlertDrv.sys
  16. driver is loaded into Windows, providing
  17. alertable (pre-emptive) asyncronous threads
  18. cancelation. If this feature returns FALSE
  19. then the default async cancel scheme is in
  20. use, which cannot cancel blocked threads.
  21. Features may be Or'ed into the mask parameter, in which case
  22. the routine returns TRUE if any of the Or'ed features would
  23. return TRUE. At this stage it doesn't make sense to Or features
  24. but it may some day.
  25. void *
  26. pthread_timechange_handler_np(void *)
  27.         To improve tolerance against operator or time service
  28.         initiated system clock changes.
  29.         This routine can be called by an application when it
  30.         receives a WM_TIMECHANGE message from the system. At
  31.         present it broadcasts all condition variables so that
  32.         waiting threads can wake up and re-evaluate their
  33.         conditions and restart their timed waits if required.
  34.         It has the same return type and argument type as a
  35.         thread routine so that it may be called directly
  36.         through pthread_create(), i.e. as a separate thread.
  37.         Parameters
  38.         Although a parameter must be supplied, it is ignored.
  39.         The value NULL can be used.
  40.         Return values
  41.         It can return an error EAGAIN to indicate that not
  42.         all condition variables were broadcast for some reason.
  43.         Otherwise, 0 is returned.
  44.         If run as a thread, the return value is returned
  45.         through pthread_join().
  46.         The return value should be cast to an integer.
  47. HANDLE
  48. pthread_getw32threadhandle_np(pthread_t thread);
  49. Returns the win32 thread handle that the POSIX
  50. thread "thread" is running as.
  51. Applications can use the win32 handle to set
  52. win32 specific attributes of the thread.
  53. int
  54. pthread_mutexattr_setkind_np(pthread_mutexattr_t * attr, int kind)
  55. int
  56. pthread_mutexattr_getkind_np(pthread_mutexattr_t * attr, int *kind)
  57.         These two routines are included for Linux compatibility
  58.         and are direct equivalents to the standard routines
  59.                 pthread_mutexattr_settype
  60.                 pthread_mutexattr_gettype
  61.         pthread_mutexattr_setkind_np accepts the following
  62.         mutex kinds:
  63.                 PTHREAD_MUTEX_FAST_NP
  64.                 PTHREAD_MUTEX_ERRORCHECK_NP
  65.                 PTHREAD_MUTEX_RECURSIVE_NP
  66.         These are really just equivalent to (respectively):
  67.                 PTHREAD_MUTEX_NORMAL
  68.                 PTHREAD_MUTEX_ERRORCHECK
  69.                 PTHREAD_MUTEX_RECURSIVE
  70. int
  71. pthread_delay_np (const struct timespec *interval);
  72.         This routine causes a thread to delay execution for a specific period of time.
  73.         This period ends at the current time plus the specified interval. The routine
  74.         will not return before the end of the period is reached, but may return an
  75.         arbitrary amount of time after the period has gone by. This can be due to
  76.         system load, thread priorities, and system timer granularity.
  77.         Specifying an interval of zero (0) seconds and zero (0) nanoseconds is
  78.         allowed and can be used to force the thread to give up the processor or to
  79.         deliver a pending cancelation request.
  80.         This routine is a cancelation point.
  81.         The timespec structure contains the following two fields:
  82.                 tv_sec is an integer number of seconds.
  83.                 tv_nsec is an integer number of nanoseconds. 
  84.         Return Values
  85.         If an error condition occurs, this routine returns an integer value
  86.         indicating the type of error. Possible return values are as follows:
  87.         0          Successful completion. 
  88.         [EINVAL]   The value specified by interval is invalid. 
  89. int
  90. pthread_num_processors_np
  91.         This routine (found on HPUX systems) returns the number of processors
  92.         in the system. This implementation actually returns the number of
  93.         processors available to the process, which can be a lower number
  94.         than the system's number, depending on the process's affinity mask.
  95. BOOL
  96. pthread_win32_process_attach_np (void);
  97. BOOL
  98. pthread_win32_process_detach_np (void);
  99. BOOL
  100. pthread_win32_thread_attach_np (void);
  101. BOOL
  102. pthread_win32_thread_detach_np (void);
  103. These functions contain the code normally run via dllMain
  104. when the library is used as a dll but which need to be
  105. called explicitly by an application when the library
  106. is statically linked.
  107. You will need to call pthread_win32_process_attach_np() before
  108. you can call any pthread routines when statically linking.
  109. You should call pthread_win32_process_detach_np() before
  110. exiting your application to clean up.
  111. pthread_win32_thread_attach_np() is currently a no-op, but
  112. pthread_win32_thread_detach_np() is needed to clean up
  113. the implicit pthread handle that is allocated to a Win32 thread if
  114. it calls certain pthreads routines. Call this routine when the
  115. Win32 thread exits.
  116. These functions invariably return TRUE except for
  117. pthread_win32_process_attach_np() which will return FALSE
  118. if pthreads-win32 initialisation fails.
  119. int
  120. pthreadCancelableWait (HANDLE waitHandle);
  121. int
  122. pthreadCancelableTimedWait (HANDLE waitHandle, DWORD timeout);
  123. These two functions provide hooks into the pthread_cancel
  124. mechanism that will allow you to wait on a Windows handle
  125. and make it a cancellation point. Both functions block
  126. until either the given w32 handle is signaled, or
  127. pthread_cancel has been called. It is implemented using
  128. WaitForMultipleObjects on 'waitHandle' and a manually
  129. reset w32 event used to implement pthread_cancel.
  130. Non-portable issues
  131. -------------------
  132. Thread priority
  133. POSIX defines a single contiguous range of numbers that determine a
  134. thread's priority. Win32 defines priority classes and priority
  135. levels relative to these classes. Classes are simply priority base
  136. levels that the defined priority levels are relative to such that,
  137. changing a process's priority class will change the priority of all
  138. of it's threads, while the threads retain the same relativity to each
  139. other.
  140. A Win32 system defines a single contiguous monotonic range of values
  141. that define system priority levels, just like POSIX. However, Win32
  142. restricts individual threads to a subset of this range on a
  143. per-process basis.
  144. The following table shows the base priority levels for combinations
  145. of priority class and priority value in Win32.
  146.  Process Priority Class               Thread Priority Level
  147.  -----------------------------------------------------------------
  148.  1 IDLE_PRIORITY_CLASS                THREAD_PRIORITY_IDLE
  149.  1 BELOW_NORMAL_PRIORITY_CLASS        THREAD_PRIORITY_IDLE
  150.  1 NORMAL_PRIORITY_CLASS              THREAD_PRIORITY_IDLE
  151.  1 ABOVE_NORMAL_PRIORITY_CLASS        THREAD_PRIORITY_IDLE
  152.  1 HIGH_PRIORITY_CLASS                THREAD_PRIORITY_IDLE
  153.  2 IDLE_PRIORITY_CLASS                THREAD_PRIORITY_LOWEST
  154.  3 IDLE_PRIORITY_CLASS                THREAD_PRIORITY_BELOW_NORMAL
  155.  4 IDLE_PRIORITY_CLASS                THREAD_PRIORITY_NORMAL
  156.  4 BELOW_NORMAL_PRIORITY_CLASS        THREAD_PRIORITY_LOWEST
  157.  5 IDLE_PRIORITY_CLASS                THREAD_PRIORITY_ABOVE_NORMAL
  158.  5 BELOW_NORMAL_PRIORITY_CLASS        THREAD_PRIORITY_BELOW_NORMAL
  159.  5 Background NORMAL_PRIORITY_CLASS   THREAD_PRIORITY_LOWEST
  160.  6 IDLE_PRIORITY_CLASS                THREAD_PRIORITY_HIGHEST
  161.  6 BELOW_NORMAL_PRIORITY_CLASS        THREAD_PRIORITY_NORMAL
  162.  6 Background NORMAL_PRIORITY_CLASS   THREAD_PRIORITY_BELOW_NORMAL
  163.  7 BELOW_NORMAL_PRIORITY_CLASS        THREAD_PRIORITY_ABOVE_NORMAL
  164.  7 Background NORMAL_PRIORITY_CLASS   THREAD_PRIORITY_NORMAL
  165.  7 Foreground NORMAL_PRIORITY_CLASS   THREAD_PRIORITY_LOWEST
  166.    8 BELOW_NORMAL_PRIORITY_CLASS        THREAD_PRIORITY_HIGHEST
  167.  8 NORMAL_PRIORITY_CLASS              THREAD_PRIORITY_ABOVE_NORMAL
  168.  8 Foreground NORMAL_PRIORITY_CLASS   THREAD_PRIORITY_BELOW_NORMAL
  169.  8 ABOVE_NORMAL_PRIORITY_CLASS        THREAD_PRIORITY_LOWEST
  170.  9 NORMAL_PRIORITY_CLASS              THREAD_PRIORITY_HIGHEST
  171.  9 Foreground NORMAL_PRIORITY_CLASS   THREAD_PRIORITY_NORMAL
  172.  9 ABOVE_NORMAL_PRIORITY_CLASS        THREAD_PRIORITY_BELOW_NORMAL
  173. 10 Foreground NORMAL_PRIORITY_CLASS   THREAD_PRIORITY_ABOVE_NORMAL
  174. 10 ABOVE_NORMAL_PRIORITY_CLASS        THREAD_PRIORITY_NORMAL
  175. 11 Foreground NORMAL_PRIORITY_CLASS   THREAD_PRIORITY_HIGHEST
  176. 11 ABOVE_NORMAL_PRIORITY_CLASS        THREAD_PRIORITY_ABOVE_NORMAL
  177. 11 HIGH_PRIORITY_CLASS                THREAD_PRIORITY_LOWEST
  178. 12 ABOVE_NORMAL_PRIORITY_CLASS        THREAD_PRIORITY_HIGHEST
  179. 12 HIGH_PRIORITY_CLASS                THREAD_PRIORITY_BELOW_NORMAL
  180. 13 HIGH_PRIORITY_CLASS                THREAD_PRIORITY_NORMAL
  181. 14 HIGH_PRIORITY_CLASS                THREAD_PRIORITY_ABOVE_NORMAL
  182. 15 HIGH_PRIORITY_CLASS                THREAD_PRIORITY_HIGHEST
  183. 15 HIGH_PRIORITY_CLASS                THREAD_PRIORITY_TIME_CRITICAL
  184. 15 IDLE_PRIORITY_CLASS                THREAD_PRIORITY_TIME_CRITICAL
  185. 15 BELOW_NORMAL_PRIORITY_CLASS        THREAD_PRIORITY_TIME_CRITICAL
  186. 15 NORMAL_PRIORITY_CLASS              THREAD_PRIORITY_TIME_CRITICAL
  187. 15 ABOVE_NORMAL_PRIORITY_CLASS        THREAD_PRIORITY_TIME_CRITICAL
  188. 16 REALTIME_PRIORITY_CLASS            THREAD_PRIORITY_IDLE
  189. 17 REALTIME_PRIORITY_CLASS            -7
  190. 18 REALTIME_PRIORITY_CLASS            -6
  191. 19 REALTIME_PRIORITY_CLASS            -5
  192. 20 REALTIME_PRIORITY_CLASS            -4
  193. 21 REALTIME_PRIORITY_CLASS            -3
  194. 22 REALTIME_PRIORITY_CLASS            THREAD_PRIORITY_LOWEST
  195. 23 REALTIME_PRIORITY_CLASS            THREAD_PRIORITY_BELOW_NORMAL
  196. 24 REALTIME_PRIORITY_CLASS            THREAD_PRIORITY_NORMAL
  197. 25 REALTIME_PRIORITY_CLASS            THREAD_PRIORITY_ABOVE_NORMAL
  198. 26 REALTIME_PRIORITY_CLASS            THREAD_PRIORITY_HIGHEST
  199. 27 REALTIME_PRIORITY_CLASS             3
  200. 28 REALTIME_PRIORITY_CLASS             4
  201. 29 REALTIME_PRIORITY_CLASS             5
  202. 30 REALTIME_PRIORITY_CLASS             6
  203. 31 REALTIME_PRIORITY_CLASS            THREAD_PRIORITY_TIME_CRITICAL
  204. Windows NT:  Values -7, -6, -5, -4, -3, 3, 4, 5, and 6 are not supported.
  205. As you can see, the real priority levels available to any individual
  206. Win32 thread are non-contiguous.
  207. An application using pthreads-win32 should not make assumptions about
  208. the numbers used to represent thread priority levels, except that they
  209. are monotonic between the values returned by sched_get_priority_min()
  210. and sched_get_priority_max(). E.g. Windows 95, 98, NT, 2000, XP make
  211. available a non-contiguous range of numbers between -15 and 15, while
  212. at least one version of WinCE (3.0) defines the minimum priority
  213. (THREAD_PRIORITY_LOWEST) as 5, and the maximum priority
  214. (THREAD_PRIORITY_HIGHEST) as 1.
  215. Internally, pthreads-win32 maps any priority levels between
  216. THREAD_PRIORITY_IDLE and THREAD_PRIORITY_LOWEST to THREAD_PRIORITY_LOWEST,
  217. or between THREAD_PRIORITY_TIME_CRITICAL and THREAD_PRIORITY_HIGHEST to
  218. THREAD_PRIORITY_HIGHEST. Currently, this also applies to
  219. REALTIME_PRIORITY_CLASSi even if levels -7, -6, -5, -4, -3, 3, 4, 5, and 6
  220. are supported.
  221. If it wishes, a Win32 application using pthreads-win32 can use the Win32
  222. defined priority macros THREAD_PRIORITY_IDLE through
  223. THREAD_PRIORITY_TIME_CRITICAL.