I\'ve been looking at the GCC docs for defining macros and it looks like what I want isn\'t possible, but I figure if it is, someone here would know.
What I want to
Here's a start, but you may need to tweak it:
#define synchronized(lock, func, args...) do { \ pthread_mutex_lock(&(lock)); \ func(##args); \ pthread_mutex_unlock(&(lock)); \ } while (0)
Use like this (unfortunately, not the Java-like syntax you wanted):
synchronized(x, do_thing, arg1, arg2);