Logo
Pattern

Discover published sets by community

Explore tens of thousands of sets crafted by our community.

Shared Memory Programming with Pthreads

26

Flashcards

0/26

Still learning
StarStarStarStar

pthread_exit()

StarStarStarStar

Purpose: To terminate the calling thread and optionally return a value to a joining thread. Basic Usage Example: pthread_exit(NULL);

StarStarStarStar

pthread_equal()

StarStarStarStar

Purpose: To compare two thread identifiers. Basic Usage Example: if (pthread_equal(thread1, thread2)) { /* Do something */ }

StarStarStarStar

pthread_once()

StarStarStarStar

Purpose: To ensure that a piece of initialization code is executed only once. Basic Usage Example: pthread_once(&once_control, init_routine);

StarStarStarStar

pthread_detach()

StarStarStarStar

Purpose: To detach a thread, indicating that it should not be joined. Basic Usage Example: pthread_detach(thread);

StarStarStarStar

pthread_cleanup_pop()

StarStarStarStar

Purpose: To remove the most recently installed cleanup handler. Basic Usage Example: pthread_cleanup_pop(execute);

StarStarStarStar

pthread_join()

StarStarStarStar

Purpose: To block the calling thread until the specified thread terminates. Basic Usage Example: pthread_join(thread, NULL);

StarStarStarStar

pthread_cond_signal()

StarStarStarStar

Purpose: To unblock at least one of the threads that are blocked on the specified condition variable. Basic Usage Example: pthread_cond_signal(&cond);

StarStarStarStar

pthread_cond_wait()

StarStarStarStar

Purpose: To block a thread until a specific condition is signaled. Basic Usage Example: pthread_cond_wait(&cond, &mutex);

StarStarStarStar

pthread_attr_destroy()

StarStarStarStar

Purpose: To destroy thread attributes and free any resources. Basic Usage Example: pthread_attr_destroy(&attr);

StarStarStarStar

pthread_key_delete()

StarStarStarStar

Purpose: To delete a thread-specific data key. Basic Usage Example: pthread_key_delete(key);

StarStarStarStar

pthread_create()

StarStarStarStar

Purpose: To create a new thread. Basic Usage Example: pthread_create(&thread, NULL, &function, NULL);

StarStarStarStar

pthread_cleanup_push()

StarStarStarStar

Purpose: To register a cleanup handler for the thread. Basic Usage Example: pthread_cleanup_push(handler, argument);

StarStarStarStar

pthread_setcancelstate()

StarStarStarStar

Purpose: To set the cancelability state of the calling thread. Basic Usage Example: pthread_setcancelstate(PTHREAD_CANCEL_ENABLE, NULL);

StarStarStarStar

pthread_attr_init()

StarStarStarStar

Purpose: To initialize thread attributes to default values. Basic Usage Example: pthread_attr_init(&attr);

StarStarStarStar

pthread_cond_broadcast()

StarStarStarStar

Purpose: To unblock all threads currently blocked on the specified condition variable. Basic Usage Example: pthread_cond_broadcast(&cond);

StarStarStarStar

pthread_attr_setdetachstate()

StarStarStarStar

Purpose: To set the detach state attribute of a thread. Basic Usage Example: pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_JOINABLE);

StarStarStarStar

pthread_barrier_init()

StarStarStarStar

Purpose: To initialize a thread barrier. Basic Usage Example: pthread_barrier_init(&barrier, NULL, 3);

StarStarStarStar

pthread_mutex_unlock()

StarStarStarStar

Purpose: To release a mutex lock after a critical section is executed. Basic Usage Example: pthread_mutex_unlock(&mutex);

StarStarStarStar

pthread_self()

StarStarStarStar

Purpose: To obtain the ID of the calling thread. Basic Usage Example: pthread_t this_thread = pthread_self();

StarStarStarStar

pthread_key_create()

StarStarStarStar

Purpose: To create thread-specific data keys. Basic Usage Example: pthread_key_create(&key, destructor);

StarStarStarStar

pthread_cancel()

StarStarStarStar

Purpose: To request that a thread be canceled. Basic Usage Example: pthread_cancel(thread);

StarStarStarStar

pthread_mutex_lock()

StarStarStarStar

Purpose: To acquire a mutex lock for critical section protection. Basic Usage Example: pthread_mutex_lock(&mutex);

StarStarStarStar

pthread_setspecific()

StarStarStarStar

Purpose: To associate a thread-specific value with a key. Basic Usage Example: pthread_setspecific(key, pointer);

StarStarStarStar

pthread_getspecific()

StarStarStarStar

Purpose: To retrieve the value associated with a thread-specific key. Basic Usage Example: pointer = pthread_getspecific(key);

StarStarStarStar

pthread_barrier_wait()

StarStarStarStar

Purpose: To synchronize participating threads at the barrier. Basic Usage Example: pthread_barrier_wait(&barrier);

StarStarStarStar

pthread_setcanceltype()

StarStarStarStar

Purpose: To set the cancelability type of the calling thread. Basic Usage Example: pthread_setcanceltype(PTHREAD_CANCEL_DEFERRED, NULL);

Know
0
Still learning
Click to flip
Know
0
Logo

© Hypatia.Tech. 2024 All rights reserved.