linux实例
__pop_
这个作者很懒,什么都没留下…
展开
专栏收录文章
- 默认排序
- 最新发布
- 最早发布
- 最多阅读
- 最少阅读
-
线程与信号
#include <signal.h>#include <pthread.h> #include <stdio.h> #include <unistd.h>pthread_t pthid1,pthid2;void handler(int arg){ return; }static void * fun1(void *arg){ signal(SIGUSR1,handler);原创 2017-02-06 21:34:44 · 408 阅读 · 0 评论 -
CGI
CGICGI叫做通用网关接口,用作前台和后台交互,可以用多种语言中的任何一种来写下面我用C语言来写用C语言来写有两种方式1/调用别人写好的库,我找的库是cgic库完成这个实例有3个文件,分别是cgic.c / cgic.h / test.c/*cgic.c cgic.h 就是 cgic库,在我的下载资源中有*/ /*test.c*/ #include <stdio.h> #include <std原创 2017-03-22 13:31:53 · 890 阅读 · 0 评论 -
线程与信号量
/*file1*/ #include <semaphore.h>#include <pthread.h> #include <stdio.h>pthread_t pthid1,pthid2; sem_t sem;static void * fun1(void *arg){ sem_wait(&sem); puts("second"); return NULL;原创 2017-02-06 21:13:23 · 432 阅读 · 0 评论 -
串口文件_写
#include <stdio.h> #include <string.h> #include <errno.h> #include <fcntl.h> #include <unistd.h> #include <termios.h>int fd;int open_port(int *fd,char *path)//打开默认非阻塞 tty { int flags; //O_RDWR原创 2017-02-23 22:29:29 · 557 阅读 · 0 评论 -
进程间通信之共享内存:shm
shm代码#include <stdio.h> #include <sys/ipc.h> #include <sys/shm.h>int main(int argc, const char *argv[]){ struct shm////共享内存使用的结构体的声明 { volatile int beon; pthread_rwlock_t lock原创 2017-02-22 20:46:11 · 1238 阅读 · 0 评论 -
select
#include <stdio.h> #include <stdlib.h> #include <unistd.h> #include <fcntl.h> #include <sys/time.h> #include <sys/types.h> #include <sys/stat.h> #include <linux/input.h> int main(int argc,cha原创 2017-02-07 17:02:29 · 481 阅读 · 0 评论 -
线程与条件变量和锁
#include <pthread.h>#include <stdio.h>pthread_t pthid1,pthid2,pthid_control; pthread_cond_t cond1,cond2; pthread_mutex_t mutex; static void * fun1(void *arg){ pthread_mutex_lock(&mutex); pthrea原创 2017-02-06 20:26:52 · 475 阅读 · 0 评论 -
线程与互斥锁
#include <pthread.h>#include <stdio.h> #include <unistd.h>pthread_t pthid1,pthid2; pthread_mutex_t mutex;int i = 1000;static void * fun1(void *arg){ while(1){ pthread_mutex_lock(&mutex);原创 2017-02-06 20:41:17 · 765 阅读 · 0 评论 -
线程与读写锁
#include &lt;pthread.h&gt;#include &lt;stdio.h&gt;pthread_rwlock_t lock;void * write1(void *arg) { pthread_rwlock_wrlock(&amp;lock); puts(&quot;write1&quot;); pthread_rwlock_unlock(&am原创 2017-02-06 22:19:57 · 2667 阅读 · 2 评论 -
CGI中对前端数据的处理
前端 method 有两种取值 1. GET 2. POST下面的程序完成了兼容GET与POST方式的数据处理 最后形成的字符串格式为name1=value1&name2=value2&name3=value3 ...... namei=vaulei ...... namen=valuen //当value为空时,value被填空 实例: chn1=&chn2=2&chn3=3&chn4=&c原创 2017-03-22 13:59:43 · 1565 阅读 · 0 评论
分享