php pool,精简php_connect_pool.h

老:

#if defined(__GNUC__)

#if __GNUC__ >= 3

#define CPINLINE inline __attribute__((always_inline))

#else

#define CPINLINE inline

#endif

#elif defined(_MSC_VER)

#define CPINLINE __forceinline

#else

#define CPINLINE inline

#endif

新:

#if defined(__GNUC__)

#if __GNUC__ >= 3

#define CPINLINE inline __attribute__((always_inline))

#endif

#else

#define CPINLINE inline

#endif

_MSC_VER:微软C版本,本次编译不涉及Windows系统,故不需要.

CPINLINE:声明函数为内联,即b()调用a()时,不会跳转到a()的内存地址,而是在b()中直接复制了一份儿a()的代码

inline __attribute__((always_inline)):强制内联

老:

#if defined(MAP_ANON) && !defined(MAP_ANONYMOUS)

#define MAP_ANONYMOUS MAP_ANON

#endif

新:

MAP_ANONYMOUS:用于mmap()的第4个参数,表示内存映射区不与任何文件关联.

MAP_ANON:MAP_ANONYMOUS的别名,已经被弃用.

老:

#ifndef SOCK_NONBLOCK

#define SOCK_NONBLOCK O_NONBLOCK

#endif

新:

O_NONBLOCK:非阻塞,非阻塞I/O使我们的操作要么立即返回成功,要么立即返回错误,不被阻塞.

使用方式有两种:

(1)调用open获得一个新描述符,并指定O_NONBLOCK标志.

(2)对已经打开的文件描述符,调用fcntl,打开O_NONBLOCK文件状态标志.例如:flags=fcntl(sock,F_GETFL,0));fcntl(sock,F_SETFL,flags|O_NONBLOCK);

老:

/**

* PHP5.2

*/

#ifndef PHP_FE_END

#define PHP_FE_END {NULL,NULL,NULL}

#endif

新:

老:

#ifdef PHP_WIN32

#define PHP_CONNECT_POOL_API __declspec(dllexport)

#elif defined(__GNUC__) && __GNUC__ >= 4

#define PHP_CONNECT_POOL_API __attribute__ ((visibility("default")))

#else

#define PHP_CONNECT_POOL_API

#endif

新:

#ifdef defined(__GNUC__) && __GNUC__ >= 4

#define PHP_CONNECT_POOL_API __attribute__ ((visibility("default")))

#else

#define PHP_CONNECT_POOL_API

#endif

把Windows相关的去掉了

__attribute__ ((visibility("default"))):控制函数符号表的导出,详见,http://liulixiaoyao.blog.51cto.com/1361095/814329/

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值