全部博文(28)
TCP/IP网络编程技(7)
发布时间:2013-12-13 10:32:57
#include#include#include#define P_NUMBER 255#define COUNT 100#define TEST_LOGFILE "logFile.log"FILE *logFile=NULL;char *s="Hello linux\0";int main(){ int i=0,j=0; logFile=fopen(TEST_LOGFILE,"a+"); for(i=0;i......【阅读全文】
发布时间:2013-12-12 14:39:12
#include "common.h"#define MAX_LINE 100#define THREAD_NUM 10struct sockaddr_in sin;pthread_mutex_t mutex;void sock_init();void my_read(int fd);void my_write(int fd,char *buf);void* thfn(void* arg);int main(int argc,char *argv[]){ char str[30]; int i;&n.........【阅读全文】
发布时间:2013-12-12 11:10:09
int pthread_mutex_init(pthread_mutex_t *restrict mutex,const pthread_mutexattr_t *restrict attr);pthread_mutex_t mutex=PTHREAD_MUTEX_INITIALIZER;//静态创建互斥锁该函数用于互斥锁的初始化。pthread_mutex_init()动态的创建互斥锁,参数attr指定新建互斥锁的属性,为空,使用默认的互斥锁属性,默认属性为快.........【阅读全文】