Posix多线程程序设计源码

时间:2018-10-30 02:59:36
【文件属性】:

文件名称:Posix多线程程序设计源码

文件大小:66KB

文件格式:ZIP

更新时间:2018-10-30 02:59:36

POSIX 多线程

Posix多线程程序设计书中实例源码。 头文件errors.h #ifndef __errors_h #define __errors_h #include #include #include #include #include /* * Define a macro that can be used for diagnostic output from * examples. When compiled -DDEBUG, it results in calling printf * with the specified argument list. When DEBUG is not defined, it * expands to nothing. */ #ifdef DEBUG # define DPRINTF(arg) printf arg #else # define DPRINTF(arg) #endif /* * NOTE: the "do {" ... "} while (0);" bracketing around the macros * allows the err_abort and errno_abort macros to be used as if they * were function calls, even in contexts where a trailing ";" would * generate a null statement. For example, * * if (status != 0) * err_abort (status, "message"); * else * return status; * * will not compile if err_abort is a macro ending with "}", because * C does not expect a ";" to follow the "}". Because C does expect * a ";" following the ")" in the do...while construct, err_abort and * errno_abort can be used as if they were function calls. */ #define err_abort(code,text) do { \ fprintf (stderr, "%s at \"%s\":%d: %s\n", \ text, __FILE__, __LINE__, strerror (code)); \ abort (); \ } while (0) #define errno_abort(text) do { \ fprintf (stderr, "%s at \"%s\":%d: %s\n", \ text, __FILE__, __LINE__, strerror (errno)); \ abort (); \ } while (0) #endif


【文件预览】:
POSIX多线程程序设计源码
----server.c(10KB)
----semaphore_signal.c(3KB)
----alarm_cond.c(6KB)
----workq.h(2KB)
----hello.c(569B)
----barrier_main.c(3KB)
----crew.c(15KB)
----thread_attr.c(2KB)
----flock.c(2KB)
----cancel_async.c(3KB)
----mutex_static.c(544B)
----alarm_fork.c(2KB)
----tsd_once.c(2KB)
----backoff.c(6KB)
----susp.c(9KB)
----once.c(2KB)
----cancel_cleanup.c(3KB)
----rwlock.h(2KB)
----sched_thread.c(2KB)
----alarm.c(855B)
----cancel.c(2KB)
----alarm_thread.c(2KB)
----cond_dynamic.c(1KB)
----rwlock.c(7KB)
----alarm_mutex.c(5KB)
----cancel_subcontract.c(3KB)
----barrier.h(1KB)
----cancel_disable.c(2KB)
----tsd_destructor.c(3KB)
----thread_error.c(877B)
----pipe.c(8KB)
----errors.h(1KB)
----lifecycle.c(689B)
----README(4KB)
----workq_main.c(4KB)
----cond_static.c(700B)
----rwlock_main.c(5KB)
----trylock.c(3KB)
----sigwait.c(3KB)
----cond.c(3KB)
----putchar.c(3KB)
----atfork.c(3KB)
----rwlock_try_main.c(4KB)
----barrier.c(4KB)
----Makefile(2KB)
----getlogin.c(1KB)
----semaphore_wait.c(2KB)
----mutex_attr.c(1KB)
----mutex_dynamic.c(801B)
----inertia.c(1KB)
----sigev_thread.c(3KB)
----sched_attr.c(5KB)
----thread.c(632B)
----cond_attr.c(1010B)
----workq.c(10KB)

网友评论

  • 很好的资源,用来学习linux程序开发