摘要:
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 = 阅读全文
摘要:
先看下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... 阅读全文