December 16, 2004

Poetics

Look out kid
Don't matter what you did
Walk on your tip toes
Don't try No Doz
Better stay away from those
That carry around a fire hose
Keep a clean nose
Watch the plain clothes
You don't need a weather man
To know which way the wind blows

So did I for a bit. Then I found out about the prohibitive standards of hygiene. And all that dancing!

define interface
  #include "pthread.h",
    import: {"pthread_mutex_t",
             "pthread_mutex_init",
             "pthread_mutex_destroy",
             "pthread_mutex_lock",
             "pthread_mutex_unlock"};
end interface;

define function check-error(errno :: <integer>) => ()
  if (errno < 0)
    error("POSIX error %d occured in pthreads wrapper", errno);
  end if;
end function;

define macro with-mutex
  { with-mutex (?mutex:expression) ?code:body end }
    => { let mutex = ?mutex;
         check-error(pthread-mutex-lock(mutex));
         block ()
           ?code
         cleanup
           check-error(pthread-mutex-unlock(mutex));
         end block; }
end with-mutex;

define variable mutex = make(<pthread-mutex-t>);
check-error(pthread-mutex-init(mutex, null-pointer));

with-mutex (mutex)
  format(*standard-output*, "The mutex is locked.\n");
end;

check-error(pthread-mutex-destroy(mutex));

I'm a rabbit.

But I'm a rabbit who sleeps, I'm not the hopping kind.

Do not go gentle into that good night,
Old age should burn and rave at close of day;
Rage, rage against the dying of the light.

Though wise men at their end know dark is right,
Because their words had forked no lightning they
Do not go gentle into that good night.

Good men, the last wave by, crying how bright
Their frail deeds might have danced in a green bay,
Rage, rage against the dying of the light.

Wild men who caught and sang the sun in flight,
And learn, too late, they grieved it on its way,
Do not go gentle into that good night.

Grave men, near death, who see with blinding sight
Blind eyes could blaze like meteors and be gay,
Rage, rage against the dying of the light.

And you, my father, there on that sad height,
Curse, bless, me now with your fierce tears, I pray.
Do not go gentle into that good night.
Rage, rage against the dying of the light.


Posted by matt at December 16, 2004 11:39 PM

Comments
Comments for this post are now closed, but feel free to email me if you have something interesting to say.