[LCP] Multi threading programming
Kim Hawtin
kim.hawtin at adelaide.edu.au
Fri Feb 20 13:41:57 EST 2009
Christopher Howard wrote:
> I'm am entirely unexperienced at multi threaded programming, but am about
> to try and figure it out. For one of my programs I wanted to create a
> simple "internal counter" function which which sleeps for 1000
> milliseconds, then increments a global variable which other functions can
> read. (I know this doesn't work as an accurate clock, but that is okay.)
>
> My question: Does the global variable have to be some kind of atomic
> variable? Will this still work correctly if it is an int or a long int? I
> read something on the Internet about locking variables... does that apply
> here?
>
> Any (simple) examples would also be appreciated. Thank you in advance.
I have recently discovered 'antithread' from CCAN; http://ccan.ozlabs.org/list.html
I'm working my way through some other problems right now, so haven't used it yet.
There is also a channel on irc.freenode.net, #ccan
regards,
Kim
--
Operating Systems, Services and Operations
Information Technology Services, The University of Adelaide
kim.hawtin at adelaide.edu.au
More information about the linuxCprogramming
mailing list