Consider the following C program that uses the POSIX API:
void *thread_function(void *argument) {
const char *ptr = (const char *) argument;
write(STDOUT_FILENO, ptr, strlen(ptr));
return NULL;
}
int main(int argc, const char **argv) {
pthread_t a, b;
pthread_create(&a, NULL, thread_function, (void *) "A");
pthread_create(&b, NULL, thread_function, (void *) "B");
pthread_join(a, NULL);
write(STDOUT_FILENO, "C", 1);
pthread_join(b, NULL);
return 0;
}
Assume none of the calls to pthread_create, pthread_join, or write fail and ignore minor syntax errors, missing includes, etc. Which of the following are possible outputs of this code? Select all that apply.
A. BAC
B. ACB
C. ABC
D. BCB
E. BCA
F. AC