void update_tweet_list(void)
{
PGresult *result = PQexec(conn, "SELECT link from latestImage LIMIT 1;");
if (PQntuples(result) > 0)
{
int urlLength = PQgetlength(result, 0, 0);
atomic_flag_test_and_set(&inImageUpdate);
while (atomic_flag_test_and_set(&inImageRequest)) usleep(0);
atomic_flag_clear(&inImageRequest);
if (!latestImage.p)
{
latestImage.p = malloc(urlLength);
}
else if (urlLength > latestImage.len)