Evolved code for a sophisticated reader writer thread problem