예제 #1
0
int
test_random_generator()
{
#if !defined(NDEBUG)

    std::cout << std::hex;

    {
        const int first = rand();
        const int second = rand();

        std::cout << first << " " << second << std::endl;
    }

    {
        int random_buffer[10] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9};
        std::random_shuffle(random_buffer, random_buffer+10);
        for (size_t kk=0; kk<10; kk++)
            std::cout << random_buffer[kk] << " ";
        std::cout << std::endl;
    }

    int total_good = 0;
    int total_bad = 0;
    #pragma omp parallel default(none) shared(std::cout, total_good, total_bad)
    {
        const int first = rand();
        #pragma omp critical
        std::cout << "thread " << omp_get_thread_num() << "/" << omp_get_team_size(1) << " " << omp_get_level() << " " << first << std::endl;
        #pragma omp for
        for (size_t kk=0; kk<10; kk++)
        {
            const int second = rand();
            #pragma omp critical
            std::cout << "  in for " << omp_get_thread_num() << " " << omp_get_level() << " " << second << " " << kk << std::endl;
            called_function(kk);
            #pragma omp atomic update
            total_good++;
            total_bad++;
        }
    }

    std::cout << std::dec;
    std::cout << "good " << total_good << " bad " << total_bad << std::endl;

#endif
    return rand();
}
예제 #2
0
Action* DBusAction::copy( ActionData* data_P ) const
    {
    return new DBusAction( data_P, remote_application(), remote_object(),
        called_function(), arguments());
    }
예제 #3
0
const QString DBusAction::description() const
    {
    return i18n( "D-Bus: " ) + remote_application() + "::" + remote_object() + "::"
        + called_function();
    }