예제 #1
0
uint32_t
access_pool (uint32_t flag)
{
    static pthread_mutex_t g_access_mutex = PTHREAD_MUTEX_INITIALIZER;
    if (flag == 0)
        ::pthread_mutex_lock (&g_access_mutex);

    char old_val = *g_char_ptr;
    if (flag != 0)
        do_bad_thing_with_location(g_char_ptr, old_val + 1);

    if (flag == 0)
        ::pthread_mutex_unlock (&g_access_mutex);
    return *g_char_ptr;
}
예제 #2
0
파일: main.cpp 프로젝트: llvm-project/lldb
uint32_t
access_pool (bool flag = false)
{
    static std::mutex g_access_mutex;
    if (!flag)
        g_access_mutex.lock();

    char old_val = *g_char_ptr;
    if (flag)
        do_bad_thing_with_location(g_char_ptr, old_val + 1);

    if (!flag)
        g_access_mutex.unlock();
    return *g_char_ptr;
}