Lines Matching defs:thread

11 #include "thread/thread_internal.h"
13 #include "thread/thread.c"
19 _thread_schedule(struct spdk_thread *thread)
36 _thread_op(struct spdk_thread *thread, enum spdk_thread_op op)
40 return _thread_schedule(thread);
49 struct spdk_thread *thread;
53 thread = spdk_thread_create(NULL, NULL);
54 SPDK_CU_ASSERT_FATAL(thread != NULL);
55 spdk_set_thread(thread);
56 spdk_thread_exit(thread);
57 while (!spdk_thread_is_exited(thread)) {
58 spdk_thread_poll(thread, 0, 0);
60 spdk_thread_destroy(thread);
68 thread = spdk_thread_create(NULL, NULL);
69 SPDK_CU_ASSERT_FATAL(thread != NULL);
70 spdk_set_thread(thread);
71 spdk_thread_exit(thread);
72 while (!spdk_thread_is_exited(thread)) {
73 spdk_thread_poll(thread, 0, 0);
75 spdk_thread_destroy(thread);
79 thread = spdk_thread_create(NULL, NULL);
80 SPDK_CU_ASSERT_FATAL(thread == NULL);
84 /* Scheduling callback exists with extended thread library initialization. */
90 thread = spdk_thread_create(NULL, NULL);
91 SPDK_CU_ASSERT_FATAL(thread != NULL);
92 spdk_set_thread(thread);
93 spdk_thread_exit(thread);
94 while (!spdk_thread_is_exited(thread)) {
95 spdk_thread_poll(thread, 0, 0);
97 spdk_thread_destroy(thread);
101 thread = spdk_thread_create(NULL, NULL);
102 SPDK_CU_ASSERT_FATAL(thread == NULL);
126 /* Simulate thread 1 sending a message to thread 0. */
129 /* We have not polled thread 0 yet, so done should be false. */
133 * Poll thread 1. The message was sent to thread 0, so this should be
140 * Poll thread 0. This should execute the message and done should then
329 /* Poll the thread to make sure the previous poller gets unregistered */
468 /* We have not polled thread 0 yet, so count should be 0 */
471 /* Poll each thread to verify the message is passed to each */
478 * After each thread is called, the completion calls it
561 * thread 0 is polled.
667 struct spdk_thread *thread;
672 /* Create thread with no name, which automatically generates one */
673 thread = spdk_thread_create(NULL, NULL);
674 spdk_set_thread(thread);
675 thread = spdk_get_thread();
676 SPDK_CU_ASSERT_FATAL(thread != NULL);
677 name = spdk_thread_get_name(thread);
679 spdk_thread_exit(thread);
680 while (!spdk_thread_is_exited(thread)) {
681 spdk_thread_poll(thread, 0, 0);
683 spdk_thread_destroy(thread);
685 /* Create thread named "test_thread" */
686 thread = spdk_thread_create("test_thread", NULL);
687 spdk_set_thread(thread);
688 thread = spdk_get_thread();
689 SPDK_CU_ASSERT_FATAL(thread != NULL);
690 name = spdk_thread_get_name(thread);
693 spdk_thread_exit(thread);
694 while (!spdk_thread_is_exited(thread)) {
695 spdk_thread_poll(thread, 0, 0);
697 spdk_thread_destroy(thread);
866 struct spdk_thread *thread;
878 /* Test if all pending messages are reaped for the exiting thread, and the
879 * thread moves to the exited state.
882 thread = spdk_get_thread();
884 /* Sending message to thread 0 will be accepted. */
885 rc = spdk_thread_send_msg(thread, send_msg_cb, &done1);
889 /* Move thread 0 to the exiting state. */
890 spdk_thread_exit(thread);
892 CU_ASSERT(spdk_thread_is_exited(thread) == false);
894 /* Sending message to thread 0 will be still accepted. */
895 rc = spdk_thread_send_msg(thread, send_msg_cb, &done2);
904 CU_ASSERT(spdk_thread_is_exited(thread) == true);
906 /* Test releasing I/O channel is reaped even after the thread moves to
924 thread = spdk_get_thread();
925 spdk_thread_exit(thread);
930 CU_ASSERT(spdk_thread_is_exited(thread) == false);
933 * even after the thread moves to the exiting state.
952 CU_ASSERT(spdk_thread_is_exited(thread) == true);
957 /* Test if unregistering poller is reaped for the exiting thread, and the
958 * thread moves to the exited thread.
961 thread = spdk_get_thread();
968 spdk_thread_exit(thread);
977 CU_ASSERT(spdk_thread_is_exited(thread) == false);
983 CU_ASSERT(spdk_thread_is_exited(thread) == true);
985 /* Test if the exiting thread is exited forcefully after timeout. */
987 thread = spdk_get_thread();
992 spdk_thread_exit(thread);
994 CU_ASSERT(spdk_thread_is_exited(thread) == false);
1000 CU_ASSERT(spdk_thread_is_exited(thread) == false);
1007 CU_ASSERT(spdk_thread_is_exited(thread) == true);
1043 struct spdk_thread *thread;
1050 thread = spdk_get_thread();
1052 CU_ASSERT(thread->tsc_last == 10);
1053 CU_ASSERT(thread->stats.idle_tsc == 0);
1054 CU_ASSERT(thread->stats.busy_tsc == 0);
1064 CU_ASSERT(thread->tsc_last == 1110);
1065 CU_ASSERT(thread->stats.idle_tsc == 1000);
1066 CU_ASSERT(thread->stats.busy_tsc == 0);
1072 CU_ASSERT(thread->tsc_last == 2210);
1073 CU_ASSERT(thread->stats.idle_tsc == 2000);
1074 CU_ASSERT(thread->stats.busy_tsc == 0);
1086 CU_ASSERT(thread->tsc_last == 112210);
1087 CU_ASSERT(thread->stats.idle_tsc == 2000);
1088 CU_ASSERT(thread->stats.busy_tsc == 100000);
1094 CU_ASSERT(thread->tsc_last == 222210);
1095 CU_ASSERT(thread->stats.idle_tsc == 2000);
1096 CU_ASSERT(thread->stats.busy_tsc == 200000);
1206 struct spdk_thread *thread;
1211 thread = spdk_get_thread();
1212 SPDK_CU_ASSERT_FATAL(thread != NULL);
1268 /* Start exiting the current thread after unregistering the non-nested
1271 spdk_thread_exit(thread);
1277 CU_ASSERT(spdk_thread_is_exited(thread) == false);
1283 CU_ASSERT(spdk_thread_is_exited(thread) == false);
1289 CU_ASSERT(spdk_thread_is_exited(thread) == true);
1334 /* Create two threads and each thread gets a channel from the same device. */
1356 /* Move thread 0 to the exiting state, but it should keep exiting until two channels
1371 /* Move thread 1 to the exiting state, but it should keep exiting until its channel
1401 struct spdk_thread *thread;
1407 thread = spdk_get_thread();
1408 SPDK_CU_ASSERT_FATAL(thread != NULL);
1424 CU_ASSERT(thread->first_timed_poller == poller1);
1425 CU_ASSERT(RB_MIN(timed_pollers_tree, &thread->timed_pollers) == poller1);
1430 CU_ASSERT(thread->first_timed_poller == poller2);
1431 CU_ASSERT(RB_MIN(timed_pollers_tree, &thread->timed_pollers) == poller2);
1448 CU_ASSERT(thread->first_timed_poller == tmp);
1449 CU_ASSERT(RB_MIN(timed_pollers_tree, &thread->timed_pollers) == tmp);
1454 CU_ASSERT(thread->first_timed_poller == poller3);
1455 CU_ASSERT(RB_MIN(timed_pollers_tree, &thread->timed_pollers) == poller3);
1468 CU_ASSERT(thread->first_timed_poller == poller3);
1469 CU_ASSERT(RB_MIN(timed_pollers_tree, &thread->timed_pollers) == poller3);
1474 CU_ASSERT(thread->first_timed_poller == poller1);
1475 CU_ASSERT(RB_MIN(timed_pollers_tree, &thread->timed_pollers) == poller1);
1486 CU_ASSERT(thread->first_timed_poller == NULL);
1487 CU_ASSERT(RB_EMPTY(&thread->timed_pollers));
1495 struct spdk_thread *thread;
1502 thread = spdk_get_thread();
1503 SPDK_CU_ASSERT_FATAL(thread != NULL);
1525 CU_ASSERT(thread->first_timed_poller == poller1);
1539 CU_ASSERT(thread->first_timed_poller == poller3);
1553 CU_ASSERT(thread->first_timed_poller == poller4);
1567 CU_ASSERT(thread->first_timed_poller == poller3);
1582 CU_ASSERT(thread->first_timed_poller == NULL);
1583 CU_ASSERT(RB_EMPTY(&thread->timed_pollers));
1593 CU_ASSERT(thread->first_timed_poller == poller1);
1606 CU_ASSERT(thread->first_timed_poller == poller1);
1621 CU_ASSERT(thread->first_timed_poller == tmp);
1630 CU_ASSERT(thread->first_timed_poller == poller3);
1640 CU_ASSERT(thread->first_timed_poller == poller1);
1649 CU_ASSERT(thread->first_timed_poller == NULL);
1650 CU_ASSERT(RB_EMPTY(&thread->timed_pollers));
1812 /* Do not need to be on an SPDK thread to initialize an spdk_spinlock */
1817 /* Trying to take a lock while not on an SPDK thread is an error */
1823 /* Trying to check if a lock is held while not on an SPDK thread is an error */
1829 /* Do not need to be on an SPDK thread to destroy an spdk_spinlock */
1837 /* Can initialize an spdk_spinlock on an SPDK thread */
1861 /* Cannot unlock from wrong thread */
1889 /* A lock that is held is recognized as held by only the thread that holds it. */
1950 * thread 0 does not have io_channel and calls spdk_thread_exit() immediately
1951 * after spdk_for_each_channel(). In this case, thread 0 should exit after
1999 /* Even if thread 0 starts exiting, spdk_for_each_thread() should complete normally
2000 * and then thread 0 should be moved to EXITED.
2010 /* We have not polled thread 0 yet, so count should be 0 */
2013 /* Poll each thread to verify the message is passed to each */
2020 * After each thread is called, the completion calls it