随笔分类 -  C

摘要:最近在看《Python源码剖析》中关于python多线程机制一章节,python维护着一个线程状态对象链表thread.c文件代码如下:/* Thread package. This is intended to be usable independently from Python. Th... 阅读全文
posted @ 2015-10-13 13:13 lxk613 阅读(598) 评论(0) 推荐(0)
摘要:最近阅读《Python源码剖析》对进程线程的封装解释:GIL,Global Interpreter Lock,对于python的多线程机制非常重要,其如何实现的?代码中实现如下:指向一个void*,C语言中的空指针类型可以指向任意类型。Python建立多线程环境的动作只会执行一次。PyEval_In... 阅读全文
posted @ 2015-10-07 16:02 lxk613 阅读(1161) 评论(1) 推荐(0)
摘要:http://blog.csdn.net/ztz0223/article/details/3599016http://codepad.org/DuNYSPrw//在结构体最后定义一个长度为0的字符数组(技巧)http://blog.chinaunix.net/uid-27025492-id-3271... 阅读全文
posted @ 2013-04-02 22:49 lxk613 阅读(150) 评论(0) 推荐(0)
摘要:Linux环境进程间通信(五): 共享内存(上)http://www.ibm.com/developerworks/cn/linux/l-ipc/part5/index1.htmlLinux环境进程间通信(五): 共享内存(下)http://www.ibm.com/developerworks/cn/linux/l-ipc/part5/index2.html对话 UNIX: 通过共享内存进行进程间通信http://www.ibm.com/developerworks/cn/aix/library/au-spunix_sharedmemory/index.html?ca=drs-多线程编程:ht 阅读全文
posted @ 2012-04-22 08:28 lxk613 阅读(128) 评论(0) 推荐(0)
摘要:http://stackoverflow.com/questions/2583580/what-is-the-best-way-to-write-class-template-like-generic-code-in-cstruct list_element_s{void* data;struct list_element_s next;};typedef struct list_element_s list_element;struct list_s{void (*destructor)(void* data);int (*com)(const void *src,const void* . 阅读全文
posted @ 2012-01-06 17:06 lxk613 阅读(210) 评论(0) 推荐(0)
摘要:View Code typedef struct LList LList; struct LList { int value; LList *next; }; LList *(*p)[3]; /* pointer to an array of 3 pointers to LList */ LList ll1 = {11}; LList ll2 = {22}; LList ll3 = {33}; size_t sizeofarray = sizeof*p/sizeof**p; /* calc arraysize at runtime here */ p = malloc( sizeofarra. 阅读全文
posted @ 2012-01-02 14:23 lxk613 阅读(267) 评论(0) 推荐(0)
摘要:创建多维数组,并差创建数组指针进行操作View Code #include <stdio.h> int main(int argc, char **argv) { int shape1[5][3] = {1,0,0, 1,0,0, 1,0,0, 1,0,0, 1,0,0}; int shape2[5][3] = {0,0,0, 0,0,0, 0,1,1, ... 阅读全文
posted @ 2012-01-01 16:46 lxk613 阅读(435) 评论(0) 推荐(0)
摘要:View Code #include <stdio.h>int main (void) { arrayPointer(); int arr[3] = {11,3,4}; int *p1; char *p2=(char*)arr; int i; int size1=sizeof(arr)/sizeof(arr[0]); int size2=(int)sizeof(arr); p1 = arr; printf("*p1=%d,size1=%d\n", *p1,size1); printf("*p2=%d,size2=%d\n"... 阅读全文
posted @ 2012-01-01 16:05 lxk613 阅读(258) 评论(0) 推荐(0)