selectLibP.h
上传用户:luoyougen
上传日期:2008-05-12
资源大小:23136k
文件大小:2k
源码类别:

VxWorks

开发平台:

C/C++

  1. /* selectLibP.h - private select library header */
  2. /* Copyright 2001 Wind River Systems, Inc. */
  3. /*
  4. modification history
  5. --------------------
  6. 01a,18sep01,aeg  extracted from version 02c of selectLib.h; added selContext.
  7. */
  8. #ifndef __INCselectLibP
  9. #define __INCselectLibP
  10. #ifdef __cplusplus
  11. extern "C" {
  12. #endif
  13. #ifndef _ASMLANGUAGE
  14. #include "lstLib.h"
  15. #include "private/semLibP.h"
  16. typedef struct selWkNode
  17.     {
  18.     NODE linkedListHooks;/* hooks for wakeup list */
  19.     BOOL dontFree; /* first in free list isn't malloc'ed */
  20.     int taskId; /* taskId of select'ed task */
  21.     int fd; /* fd to set in fd_set on activity */
  22.     SELECT_TYPE type; /* activity task is interested in */
  23.     } SEL_WAKEUP_NODE;
  24. typedef struct
  25.     {
  26.     SEMAPHORE listMutex; /* mutex semaphore for list */
  27.     SEL_WAKEUP_NODE firstNode; /* usually one deep, stash first one */
  28.     LIST wakeupList; /* list of SEL_WAKEUP_NODE's */
  29.     } SEL_WAKEUP_LIST;
  30. typedef struct selContext
  31.     {
  32.     SEMAPHORE wakeupSem; /* wakeup semaphore */
  33.     BOOL      pendedOnSelect; /* task pended on select? */
  34.     fd_set     *pReadFds; /* select'ed task's read fd_set */
  35.     fd_set     *pWriteFds; /* select'ed task's write fd_set */
  36.     /* the following are needed for safe task deletion */
  37.     fd_set     *pOrigReadFds; /* task's original read fd_set */
  38.     fd_set     *pOrigWriteFds; /* task's original write fd_set */
  39.     int width; /* width parm passed to select() */
  40.     /* 
  41.      * The remaining memory in the SEL_CONTEXT dynamically allocated by
  42.      * the select task create hook is used to store the various fd_set's
  43.      * referenced in the above fd_set pointers.  Note that these structures
  44.      * are not really fd_set's since their size is based on maxFiles (iosLib) 
  45.      * instead of FD_SETSIZE.
  46.      *
  47.      *
  48.      * fd_set  origReadFds; /@ memory for task's original read fd_set @/
  49.      * fd_set  origWriteFds; /@ memory for task's original write fd_set @/
  50.      */
  51.     } SEL_CONTEXT;
  52. /* function declarations */
  53. #if defined(__STDC__) || defined(__cplusplus)
  54. extern void selectInit (int numFiles);
  55. extern void selTaskDeleteHookAdd  (void);
  56. #else /* __STDC__ */
  57. extern void selectInit ();
  58. extern void selTaskDeleteHookAdd  ();
  59. #endif /* __STDC__ */
  60. #endif /* _ASMLANGUAGE */
  61. #ifdef __cplusplus
  62. }
  63. #endif
  64. #endif /* __INCselectLibP */