- File:
-
- 1 edited
-
libcfa/src/concurrency/clib/cfathread.h (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
libcfa/src/concurrency/clib/cfathread.h
r038110a ra1538cd 20 20 extern "C" { 21 21 #endif 22 #include <asm/types.h> 23 #include <errno.h> 24 #include <unistd.h> 25 26 22 27 //-------------------- 23 28 // Basic types 24 struct cfathread_CRunner_t; 25 typedef struct cfathread_CRunner_t * cfathread_t; 29 30 typedef struct cluster * cfathread_cluster_t; 31 32 int cfathread_cluster_create(cfathread_cluster_t * cluster) __attribute__((nonnull(1))); 33 cfathread_cluster_t cfathread_cluster_self(void); 34 int cfathread_cluster_add_worker(cfathread_cluster_t cluster, pthread_t* tid, void (*init_routine) (void *), void * arg); 35 int cfathread_cluster_pause (cfathread_cluster_t cluster); 36 int cfathread_cluster_resume(cfathread_cluster_t cluster); 26 37 27 38 //-------------------- 28 // Basic thread support 29 cfathread_t cfathread_create( void (*main)( cfathread_t ) ); 30 void cfathread_join( cfathread_t ); 39 // thread attribute 40 typedef struct cfathread_attr { 41 cfathread_cluster_t cl; 42 } cfathread_attr_t; 43 44 int cfathread_attr_init(cfathread_attr_t * attr) __attribute__((nonnull (1))); 45 static inline int cfathread_attr_destroy(cfathread_attr_t * attr) __attribute__((nonnull (1))) { return 0; } 46 static inline int cfathread_attr_setbackground(cfathread_attr_t * attr, int background) __attribute__((nonnull (1))) { return 0; } 47 static inline int cfathread_attr_setcluster(cfathread_attr_t * attr, cfathread_cluster_t cl) __attribute__((nonnull (1))) { attr->cl = cl; return 0; } 48 49 //-------------------- 50 // thread type 51 struct cfathread_object; 52 typedef struct cfathread_object * cfathread_t; 53 54 int cfathread_create( cfathread_t * h, cfathread_attr_t * a, void *(*main)( void * ), void * arg ) __attribute__((nonnull (1))); 55 int cfathread_join( cfathread_t, void ** retval ); 56 57 int cfathread_get_errno(void); 58 cfathread_t cfathread_self(void); 59 60 int cfathread_usleep(useconds_t usecs); 61 int cfathread_sleep(unsigned int secs); 31 62 32 63 void cfathread_park( void ); … … 35 66 36 67 //-------------------- 37 // Basic kernel features38 void cfathread_setproccnt( int );68 // mutex and condition 69 struct timespec; 39 70 71 typedef struct cfathread_mutex_attr { 72 } cfathread_mutexattr_t; 73 typedef struct cfathread_mutex * cfathread_mutex_t; 74 int cfathread_mutex_init(cfathread_mutex_t *restrict mut, const cfathread_mutexattr_t *restrict attr) __attribute__((nonnull (1))); 75 int cfathread_mutex_destroy(cfathread_mutex_t *mut) __attribute__((nonnull (1))); 76 int cfathread_mutex_lock(cfathread_mutex_t *mut) __attribute__((nonnull (1))); 77 int cfathread_mutex_trylock(cfathread_mutex_t *mut) __attribute__((nonnull (1))); 78 int cfathread_mutex_unlock(cfathread_mutex_t *mut) __attribute__((nonnull (1))); 79 80 typedef struct cfathread_cond_attr { 81 } cfathread_condattr_t; 82 typedef struct cfathread_condition * cfathread_cond_t; 83 int cfathread_cond_init(cfathread_cond_t *restrict cond, const cfathread_condattr_t *restrict attr) __attribute__((nonnull (1))); 84 int cfathread_cond_wait(cfathread_cond_t *restrict cond, cfathread_mutex_t *restrict mut) __attribute__((nonnull (1,2))); 85 int cfathread_cond_timedwait(cfathread_cond_t *restrict cond, cfathread_mutex_t *restrict mut, const struct timespec *restrict abstime) __attribute__((nonnull (1,2,3))); 86 int cfathread_cond_signal(cfathread_cond_t *cond) __attribute__((nonnull (1))); 87 88 //-------------------- 89 // IO operations 90 struct sockaddr; 91 struct msghdr; 92 int cfathread_socket(int domain, int type, int protocol); 93 int cfathread_bind(int socket, const struct sockaddr *address, socklen_t address_len); 94 int cfathread_listen(int socket, int backlog); 95 int cfathread_accept(int socket, struct sockaddr *restrict address, socklen_t *restrict address_len); 96 int cfathread_connect(int socket, const struct sockaddr *address, socklen_t address_len); 97 int cfathread_dup(int fildes); 98 int cfathread_close(int fildes); 99 ssize_t cfathread_sendmsg(int socket, const struct msghdr *message, int flags); 100 ssize_t cfathread_write(int fildes, const void *buf, size_t nbyte); 101 ssize_t cfathread_recvfrom(int socket, void *restrict buffer, size_t length, int flags, struct sockaddr *restrict address, socklen_t *restrict address_len); 102 ssize_t cfathread_read(int fildes, void *buf, size_t nbyte); 103 104 void cfathread_suspendFD(int fd); 105 void cfathread_resumeFD (int fd); 40 106 41 107 #if defined(__cforall) || defined(__cplusplus)
Note:
See TracChangeset
for help on using the changeset viewer.