11 2015 档案

生产者消费者模型模版
摘要:#include #include #include pthread_cond_t notEmpty=PTHREAD_COND_INITIALIZER;pthread_cond_t notFull =PTHREAD_COND_INITIALIZER;pthread_mutex_t mutex =P... 阅读全文

posted @ 2015-11-15 12:28 reedlau 阅读(291) 评论(0) 推荐(0)

pthread primer 学习手记
摘要:建议1.不要用线程等待,不要用线程的返回状态。因为更多时候你要做的是任务的结束判定而不是线程,这个可以通过线程的同步变量做到,返回状态同样。2. exit 是退出进程的函数,无论在哪个线程中调用,整个进程程都将退出,pthread_exit是退出线程。3. posix 的join 就是win32 的... 阅读全文

posted @ 2015-11-11 21:44 reedlau 阅读(370) 评论(0) 推荐(0)

动态链接库动态加载
摘要:0.typedef void (*FortFun1)(int *ii);1.HINSTANCE hDll; FortFun1 fun1;2.hDll=LoadLibrary("abc.dll"); if (hDll==NULL) error ..3.fun=(FortFun1*)GetProcAd... 阅读全文

posted @ 2015-11-09 20:52 reedlau 阅读(174) 评论(0) 推荐(0)

cudaSetDevice和线程
摘要:1.cudaSetDevice是线程安全的2.新创建的线程默认是device 0#include #include #include #define N_THREAD 2void *thread_run(void *pp){ int *p=(int*)pp; int tid=p[... 阅读全文

posted @ 2015-11-09 14:09 reedlau 阅读(7272) 评论(2) 推荐(1)

导航