<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Uncertain Binary Thoughts &#187; C</title>
	<atom:link href="http://ankurs.com/category/c/feed/" rel="self" type="application/rss+xml" />
	<link>http://ankurs.com</link>
	<description>01110100110101010101011101100010</description>
	<lastBuildDate>Sun, 01 Jan 2012 18:20:56 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.2</generator>
		<item>
		<title>small epoll wrapper</title>
		<link>http://ankurs.com/2011/03/a-small-epoll-wrapper/</link>
		<comments>http://ankurs.com/2011/03/a-small-epoll-wrapper/#comments</comments>
		<pubDate>Sat, 12 Mar 2011 21:32:24 +0000</pubDate>
		<dc:creator>Ankur Shrivastava</dc:creator>
				<category><![CDATA[C]]></category>
		<category><![CDATA[callback]]></category>
		<category><![CDATA[epoll]]></category>
		<category><![CDATA[function]]></category>
		<category><![CDATA[Simple]]></category>
		<category><![CDATA[small]]></category>
		<category><![CDATA[wrapper]]></category>

		<guid isPermaLink="false">http://ankurs.com/?p=773</guid>
		<description><![CDATA[I remember my first encounter with epoll some time back trying to get a simple server working, implementing a proxy and then a few days back i saw one of my friend trying to get started with epoll, which made me think it will be good to have a simple wrapper around epoll which will&#8230;]]></description>
			<content:encoded><![CDATA[<p>I remember my first encounter with epoll some time back trying to get a simple server working, implementing a proxy and then a few days back i saw one of my friend trying to get started with epoll, which made me think it will be good to have a simple wrapper around epoll which will allow me to get started with the application and not worry about epoll specifics and at the same time providing enough control, so i wrote a small wrapper with callbacks, which has been quite helpful for my epoll usage, here is the interface <a href="https://github.com/ankurs/Poll-Event/blob/master/poll.h">poll.h</a><br />
<script src="https://gist.github.com/867567.js?file=poll.h"></script><br />
code and a sample can be found on <a href="https://github.com/ankurs/Poll-Event">github</a></p>
<p>PS &#8211; just checkout <a href="http://www.monkey.org/~provos/libevent/">libevent</a> which is an awesome battle tested event notification library, and a quick <a href="http://www.wangafu.net/~nickm/libevent-book/">getting started</a></p>
]]></content:encoded>
			<wfw:commentRss>http://ankurs.com/2011/03/a-small-epoll-wrapper/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Simple hash tables in c</title>
		<link>http://ankurs.com/2011/03/simple-hash-tables-in-c/</link>
		<comments>http://ankurs.com/2011/03/simple-hash-tables-in-c/#comments</comments>
		<pubDate>Fri, 11 Mar 2011 14:07:46 +0000</pubDate>
		<dc:creator>Ankur Shrivastava</dc:creator>
				<category><![CDATA[C]]></category>
		<category><![CDATA[hast]]></category>
		<category><![CDATA[Simple]]></category>
		<category><![CDATA[table]]></category>

		<guid isPermaLink="false">http://ankurs.com/?p=764</guid>
		<description><![CDATA[I was working on a code where i had to lookup a structure based on the file descriptor (socket) again and again in a code, i was using a linked list initially but as the nodes grew i knew i should use a hash table, so i wrote a simple hash table implementation which did&#8230;]]></description>
			<content:encoded><![CDATA[<p>I was working on a code where i had to lookup a structure based on the file descriptor (socket) again and again in a code, i was using a linked list initially but as the nodes grew i knew i should use a hash table, so i wrote a simple hash table implementation which did the work.<br />
its a <em>just works</em> implementation there are a lot of thing which can be added like a <a href="http://en.wikipedia.org/wiki/Perfect_hash_function">perfect hash function</a> but as long as hash table is not the bottle neck this should work, code can be found on <a href="http://github.com/ankurs/Hash-Table/">github</a><br />
file <a href="https://github.com/ankurs/Hash-Table/raw/master/hashtable.h">hashtable.h</a> contains the definition<br />
<script src="https://gist.github.com/865909.js?file=hashtable.h"> </script><br />
<span id="more-764"></span><br />
file <a href="https://github.com/ankurs/Hash-Table/raw/master/hashtable.c">hashtable.c</a> contains the implementaion<br />
<script src="https://gist.github.com/865909.js?file=hashtable.c"> </script></p>
<p>file <a href="https://github.com/ankurs/Hash-Table/raw/master/Makefile">Makefile</a> is the makefile<br />
<script src="https://gist.github.com/865909.js?file=Makefile"> </script></p>
<p>file <a href="https://github.com/ankurs/Hash-Table/raw/master/main.c">main.c</a> contains the sample<br />
<script src="https://gist.github.com/865909.js?file=main.c"> </script></p>
<p>file <a href="https://github.com/ankurs/Hash-Table/raw/master/debug.h">debug.h</a> contains some debugging options<br />
<script src="https://gist.github.com/865909.js?file=debug.h"> </script></p>
]]></content:encoded>
			<wfw:commentRss>http://ankurs.com/2011/03/simple-hash-tables-in-c/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Simple Finite State Machines in C</title>
		<link>http://ankurs.com/2010/04/simple-finite-state-machines-in-c/</link>
		<comments>http://ankurs.com/2010/04/simple-finite-state-machines-in-c/#comments</comments>
		<pubDate>Sun, 04 Apr 2010 21:42:15 +0000</pubDate>
		<dc:creator>Ankur Shrivastava</dc:creator>
				<category><![CDATA[C]]></category>
		<category><![CDATA[college]]></category>
		<category><![CDATA[fedora]]></category>
		<category><![CDATA[finite]]></category>
		<category><![CDATA[fsm]]></category>
		<category><![CDATA[machine]]></category>
		<category><![CDATA[state]]></category>

		<guid isPermaLink="false">http://ankurs.com/?p=617</guid>
		<description><![CDATA[I was having discussion about State Machines with one of my friend, regarding pro&#8217;s and con&#8217;s of implementing programs as Sate Machines, it was then that i realised there is no simple way to implement programs as Finite State Machines, so here is a very basic implementation of FSM in C file: fsm.h contains the&#8230;]]></description>
			<content:encoded><![CDATA[<p>I was having discussion about State Machines with one of my friend, regarding pro&#8217;s and con&#8217;s of implementing programs as Sate Machines, it was then that i realised there is no simple way to implement programs as Finite State Machines, so here is a very basic implementation of FSM in C</p>
<p>file: <a href="http://gist.github.com/raw/355708/8046352e1209396bc7485dfa8e7ab9236d685e89/fsm.h">fsm.h</a> contains the function definition for our FSM<br />
<script src="http://gist.github.com/355708.js?file=fsm.h"></script></p>
<p><span id="more-617"></span><br />
file: <a href="http://gist.github.com/raw/355708/4a1b7b3d51b5f470a6c5e4344fb69e5e1ebbebc4/fsm.c">fsm.c</a> contains the function implementation for our FSM<br />
<script src="http://gist.github.com/355708.js?file=fsm.c"></script></p>
<p>file: <a href="http://gist.github.com/raw/355708/3b79787def0978345fa9ae3b67a2daf3ab89102a/main.c">main.c</a> contains an example on how this FSM can be used<br />
<script src="http://gist.github.com/355708.js?file=main.c"></script></p>
<p>PS &#8211; If you are reading this post on a blog aggregator  like planet you can view full post <a href="http://ankurs.com/2010/04/simple-finite-state-machines-in-c/">here</a></p>
]]></content:encoded>
			<wfw:commentRss>http://ankurs.com/2010/04/simple-finite-state-machines-in-c/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Getting started with pthread</title>
		<link>http://ankurs.com/2009/09/getting-started-with-pthread/</link>
		<comments>http://ankurs.com/2009/09/getting-started-with-pthread/#comments</comments>
		<pubDate>Thu, 24 Sep 2009 19:38:34 +0000</pubDate>
		<dc:creator>Ankur Shrivastava</dc:creator>
				<category><![CDATA[C]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[begining]]></category>
		<category><![CDATA[howto]]></category>
		<category><![CDATA[program]]></category>
		<category><![CDATA[pthread]]></category>

		<guid isPermaLink="false">http://ankurs.com/?p=562</guid>
		<description><![CDATA[Recently i have started coding in C a lot and what i came across from a lot of people is that doing Threading in C is very hard, is it really like that? here is a simple Pthread program that should clear that up get it here in the above program i have just created&#8230;]]></description>
			<content:encoded><![CDATA[<p>Recently i have started coding in C a lot and what i came across from a lot of people is that doing Threading in C is very hard, is it really like that? here is a simple Pthread program that should clear that up<br />
<script src="http://gist.github.com/179778.js"></script><br />
get it <a href="http://gist.github.com/179778">here</a></p>
<p>in the above program i have just created 2 threads and passed thr1 ( = 1 ) and thr2 ( = 2 ) values as parameters the function void * thread ( void * ptr ) is executes as a separate thread, we create two thread objects thread1 and thread2, and start threads using pthread_create function passing thread object, function pointer and parameters as arguments, here NULL specifies default attributes for the thread, we can change this by passing pthread_attr_t structure instead of NULL.<br />
we wait for the threads to finish using the pthread_join function<br />
One major problem that is faced by most of the people is of using a library which is not a thread safe library, so you need to be careful about the libraries you use in your program, if not sure about a particular library being thread safe, just assume it not to be thread safe</p>
<p>PS &#8211; No updates from a long time as i dont have a proper net connection &#8230;.</p>
]]></content:encoded>
			<wfw:commentRss>http://ankurs.com/2009/09/getting-started-with-pthread/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

