摘要: 学习了网络上的这篇文章:http://liyong-zone.blog.sohu.com/102060659.html致谢。编译的时候用:g++ -o testsig.o testsig.cpp试着运行了一下:[root@localhost test]# cat testsig.cpp#include <iostream>#include <signal.h>using namespace std;void CatchSigUsr1(int sig){ cout<<"SIGUSR1 Caught"<<endl;}void Ca 阅读全文
posted @ 2012-10-29 16:31 健哥的数据花园 阅读(20502) 评论(0) 推荐(1)
摘要: [作者:技术者高健@博客园 mail:luckyjackgao@gmail.com]在bgwriter的代码中,有这样一段,其中的MyProc显得很突兀:/* * Loop forever */ for (;;) { bool can_hibernate; int rc; ... 阅读全文
posted @ 2012-10-29 14:39 健哥的数据花园 阅读(1057) 评论(0) 推荐(0)
摘要: 我找了很多的地方,都没有找到合适的例子。最后从PostgreSQL 的代码入手,找到一些例子,于是我做了一个小练习,还不错。[作者:技术者高健@博客园 mail:luckyjackgao@gmail.com]#include "postgres.h"#include "executor/spi.h"#include "utils/builtins.h"#include "catalog/pg_type.h"#ifdef PG_MODULE_MAGICPG_MODULE_MAGIC;#endifint plantes 阅读全文
posted @ 2012-10-29 13:06 健哥的数据花园 阅读(621) 评论(0) 推荐(0)
摘要: [作者:技术者高健@博客园 mail:luckyjackgao@gmail.com]参考这个例子:http://www.postgresql.org/docs/9.1/static/spi-examples.html如果我们在 src/backend/executor/spi.c 的 SPI_finish 函数处进行调试(增加打印 SPI_finish called)可以发现,如果不在SPI 程序中调用 SPI_finish,其实会有问题。启动PostgreSQL:[root@localhost ~]# su - postgres[postgres@localhost ~]$ cd /usr/ 阅读全文
posted @ 2012-10-29 09:56 健哥的数据花园 阅读(472) 评论(0) 推荐(0)
摘要: [作者:技术者高健@博客园 mail:luckyjackgao@gmail.com]http://www.postgresql.org/docs/9.1/static/spi-examples.htmlSPI 的例子里面没有说,是如何编译和部署的,我这里补充下:编译与部署:[root@localhost soft]# export LD_LIBRARY_PATH=/usr/local/pgsql/lib[root@localhost soft]# echo $LD_LIBRARY_PATH/usr/local/pgsql/lib[root@localhost test]# cc -fpic - 阅读全文
posted @ 2012-10-29 08:33 健哥的数据花园 阅读(788) 评论(0) 推荐(0)