摘要: py.cpp:#include <iostream>#include <boost/python.hpp>#include <Python.h>using namespace boost::python;using namespace std;int main(){ Py_Initialize(); object main_module = import("__main__"); object main_namespace = main_module.attr("__dict__"); object simple = 阅读全文
posted @ 2013-01-09 12:10 轻典 阅读(262) 评论(0) 推荐(0) 编辑
摘要: 先看下Linux 下的 pthread 多线程例子:#include <pthread.h>#include <stdio.h>#include <time.h>void sleep(int sec){ clock_t delay = sec * CLOCKS_PER_SEC; clock_t start = clock(); while(clock() - start < delay);}void fun1(){ while(1){ printf( "fun1"); }}void fun2(){ while(1){ prin... 阅读全文
posted @ 2013-01-09 12:09 轻典 阅读(672) 评论(0) 推荐(1) 编辑