libixp

git clone git://oldgit.suckless.org/libixp/
Log | Files | Refs | LICENSE

IxpThread.3 (2578B)


      1 .TH "IXPTHREAD" 3 "2010 Jun" "libixp Manual"
      2 
      3 .SH NAME
      4 .P
      5 IxpThread, IxpMutex, IxpRWLock, IxpRendez, ixp_thread
      6 
      7 .SH SYNOPSIS
      8 .nf
      9   #include <ixp.h>
     10   
     11   typedef struct IxpThread IxpThread;
     12   struct IxpThread {
     13           /* Read/write lock */
     14           int     (*initrwlock)(IxpRWLock*);
     15           void    (*rlock)(IxpRWLock*);
     16           int     (*canrlock)(IxpRWLock*);
     17           void    (*runlock)(IxpRWLock*);
     18           void    (*wlock)(IxpRWLock*);
     19           int     (*canwlock)(IxpRWLock*);
     20           void    (*wunlock)(IxpRWLock*);
     21           void    (*rwdestroy)(IxpRWLock*);
     22           /* Mutex */
     23           int     (*initmutex)(IxpMutex*);
     24           void    (*lock)(IxpMutex*);
     25           int     (*canlock)(IxpMutex*);
     26           void    (*unlock)(IxpMutex*);
     27           void    (*mdestroy)(IxpMutex*);
     28           /* Rendezvous point */
     29           int     (*initrendez)(IxpRendez*);
     30           void    (*sleep)(IxpRendez*);
     31           int     (*wake)(IxpRendez*);
     32           int     (*wakeall)(IxpRendez*);
     33           void    (*rdestroy)(IxpRendez*);
     34           /* Other */
     35           char*   (*errbuf)(void);
     36           ssize_t (*read)(int, void*, size_t);
     37           ssize_t (*write)(int, const void*, size_t);
     38           int     (*select)(int, fd_set*, fd_set*, fd_set*, struct timeval*);
     39   }
     40   
     41   typedef struct IxpMutex IxpMutex;
     42   struct IxpMutex {
     43           void*   aux;
     44   }
     45   
     46   typedef struct IxpRWLock IxpRWLock;
     47   struct IxpRWLock {
     48           void*   aux;
     49   }
     50   
     51   typedef struct IxpRendez IxpRendez;
     52   struct IxpRendez {
     53           IxpMutex*       mutex;
     54           void*   aux;
     55   }
     56   
     57   IxpThread*       ixp_thread;
     58 .fi
     59 
     60 .SH DESCRIPTION
     61 .P
     62 The IxpThread structure is used to adapt libixp to any of the
     63 myriad threading systems it may be used with. Before any
     64 other of libixp's functions is called, ixp_thread may be set
     65 to a structure filled with implementations of various locking
     66 primitives, along with primitive IO functions which may
     67 perform context switches until data is available.
     68 
     69 .P
     70 The names of the functions should be fairly self\-explanitory.
     71 Read/write locks should allow multiple readers and a single
     72 writer of a shared resource, but should not allow new readers
     73 while a writer is waitng for a lock. Mutexes should allow
     74 only one accessor at a time. Rendezvous points are similar to
     75 pthread condition types. IerrbufR should return a
     76 thread\-local buffer or the size IXP_ERRMAX.
     77 
     78 .SH SEE ALSO
     79 .P
     80 ixp_pthread_init(3), ixp_taskinit(3), ixp_rubyinit(3)
     81 
     82 
     83 .\" man code generated by txt2tags 2.5 (http://txt2tags.sf.net)
     84 .\" cmdline: txt2tags -o- IxpThread.man3
     85