text stringlengths 1.16k 7.12k | label int64 0 1 | response stringclasses 2
values | clean_response int64 0 1 |
|---|---|---|---|
#include <pthread.h>
#include <stdio.h>
#include <stdlib.h>
#define BSIZE 4
#define NUMITEMS 30
typedef struct {
char buf[BSIZE];
int occupied;
int nextin, nextout;
pthread_mutex_t mutex;
pthread_cond_t more;
pthread_cond_t less;
} buffer_t;
buffer_t buffer;
void *producer(void *);
void *consumer(void *... | 1 | 1 | 1 |
#include <stdio.h>
#include <pthread.h>
#include <errno.h>
pthread_mutex_t lock_flag;
int flag = 1;
void *handlerA(void *arg)
{
int i =0;
while(1)
{
pthread_mutex_lock(&lock_flag);
if(flag == 1)
{
flag = 2;
printf("handlerA: A\\n");
i++;
}
pthread_mutex_unlock(&lock_flag);
sleep(1);
if(i >=... | 0 | 0 | 0 |
#include <pthread.h>
#include <stdio.h>
#include <stdlib.h>
#define NUM_THREADS 3
#define TCOUNT 10
#define COUNT_LIMIT 12
int count = 0;
pthread_mutex_t count_mutex;
pthread_cond_t count_threshold_cv;
void *inc_count(void *t){
int i;
long my_id = (long)t;
for(i=0; i < TCOUNT; i++){
... | 1 | 1 | 1 |
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <pthread.h>
#include <errno.h>
#include <string.h>
#include <fcntl.h>
#include <sys/mman.h>
void *producer(void *args);
void *consumer(void *args);
typedef struct {
int a_mem[0xffff];
int b_mem[0xffff];
pthread_mutex_t *a_mutex;
pthr... | 0 | 0 | 0 |
#include <pthread.h>
#include <iostream>
#include <unistd.h>
using namespace std;
#define NUM_THREADS 3
#define TCOUNT 10
#define COUNT_LIMIT 12
int count1 = 0;
pthread_mutex_t count_mutex;
pthread_cond_t count_threshold_cv;
void *inc_count(void *t) {
long my_id = (long)t;
for (int i = 0; i < TCOUNT; i++) ... | 1 | 1 | 1 |
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <pthread.h>
#include <sys/socket.h>
#include <sys/un.h>
#include <syslog.h>
static int si_init_flag = 0;
static int s_conf_fd = -1;
static struct sockaddr_un s_conf_addr;
static int s_buf_index = 0;
static char s_conf_buf[4][(16384... | 0 | 1 | 1 |
#include <stdio.h>
#include <err.h>
#include <stdlib.h>
#include <string.h>
#include <pthread.h>
struct employee {
int number;
int id;
char first_name[32];
char last_name[32];
char department[32];
int root_number;
};
struct employee employees[] = {
{ 1, 12345678, "astro", "Bluse", "Accounting", 101 },
{ 2... | 1 | 1 | 1 |
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <pthread.h>
#include <sys/socket.h>
#include <linux/netlink.h>
#include <errno.h>
extern int K;
extern int VECT_SIZE;
extern int aHash[10];
extern int bHash[10];
extern int m[10];
pthread_t ids[48];
int nextLoc = -1;
pthread_mut... | 0 | 1 | 1 |
#include "helper.h"
void pclock(char *msg, clockid_t cid) {
struct timespec ts;
printf("%s", msg);
if (clock_gettime(cid, &ts) == -1) {
perror("clock_gettime");
return;
}
printf("%4ld.%03ld\\n", ts.tv_sec, ts.tv_nsec / 1000000);
}
void errp(char *s, int code) {
fprintf(stderr,... | 1 | 0 | 0 |
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <pthread.h>
#include <assert.h>
#include <sys/time.h>
#include <dlfcn.h>
#include <errno.h>
#include <limits.h>
#include <libgen.h>
#define PERFINDEX_FAILURE -1
#define MAXPATHLEN 1024
typedef struct parsed_args_struct {
char*... | 0 | 0 | 0 |
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <pthread.h>
#include <sys/time.h>
#include <math.h>
#define GRID_SIZE 16384
float** main_plate;
float** main_prev_plate;
char** main_locked_cells;
pthread_barrier_t barrier_first;
pthread_barrier_t barrier_second;
pthread_mutex_t critical_begin_end;... | 1 | 1 | 1 |
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <pthread.h>
struct node {
char user[5];
char process;
int arrival;
int duration;
int priority;
struct node *next;
}*head;
struct display {
char user[5];
int timeLastCalculated;
struct display *n... | 0 | 0 | 0 |
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <pthread.h>
#include <time.h>
#include <stdbool.h>
struct mode_extra_status
{
int output_pipe_fd;
pthread_mutex_t mutex;
union switch_data answer;
long long rest_time[SWITCH_BUTTON_NUM + 1];
int score;
pthread_t background_worker;
bool ... | 1 | 1 | 1 |
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <pthread.h>
#include <fcntl.h>
#include <string.h>
#include <time.h>
#include <sys/time.h>
#include <errno.h>
#define MAX_CHANNEL 6
static pthread_t threadTickGenerator;
static pthread_t threadFIFO2DA[MAX_CHANNEL];
static pthread_mutex_t mutexTick[MA... | 0 | 1 | 1 |
#include <stdio.h>
#include <stdlib.h>
#include <pthread.h>
#include <unistd.h>
#include <semaphore.h>
#include <time.h>
#define THREAD_NUM 4
#define BUFFER_SIZE 256
typedef struct Task{
int a, b;
}Task;
Task taskQueue[BUFFER_SIZE];
int taskCount = 0;
pthread_mutex_t mutex;
pthread_cond_t condFull;
pthread_con... | 1 | 1 | 1 |
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <string.h>
#include <pthread.h>
#include <fcntl.h>
#include <sys/epoll.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include <errno.h>
#include <time.h>
#define MAX_CHANNEL 5
#define LISTEN_BACKLOG 50
pthread_t thread[MAX... | 0 | 1 | 1 |
#include <pthread.h>
#include <unistd.h>
#include <stdio.h>
#include<math.h>
int tickets = 20;
pthread_mutex_t mutex;
void *mythread1(void)
{
while (1)
{
if (tickets > 0)
{
usleep(1000);
printf("ticketse1 sells ticket:%d\\n", tickets--);
}
else
{... | 1 | 1 | 1 |
#include <stdio.h>
#include <pthread.h>
#include <unistd.h>
pthread_mutex_t m;
void *func(void *p) {
int *source = (int *)p;
for (int i = 0; i < 10; i++) {
pthread_mutex_lock(&m);
int t = *(source + i);
printf("t = %d\\n", t);
pthread_mutex_unlock(&m);
int j;
... | 0 | 1 | 1 |
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <pthread.h>
enum {
QUEUE_BUF_SIZE = 100000,
};
typedef struct vector_s {
int size;
int tail;
void **buf;
} vector_t;
typedef struct queue_cycl_s {
int front;
int tail;
int max_size;
void **cyclic_buf;
} queue_cycl_t;
... | 1 | 1 | 1 |
#include <stdio.h>
#include <pthread.h>
#include <semaphore.h>
#include <string.h>
#define DATA_MAX 5
#define PRO_INIT_VAL (DATA_MAX / 2)
#define CON_INIT_VAL (DATA_MAX - PRO_INIT_VAL)
static int data;
static pthread_cond_t cond = PTHREAD_COND_INITIALIZER;
static pthread_mutex_t mutex;
static sem_t sem_pro;
static sem... | 0 | 0 | 0 |
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <pthread.h>
#include <sys/socket.h>
#include <linux/netlink.h>
#include <errno.h>
enum mode {
MODE_MB,
MODE_MEMBARRIER,
MODE_COMPILER_BARRIER,
MODE_MEMBARRIER_MISSING_REGISTER,
};
enum mode mode;
struct map_test {
int x, y;
... | 1 | 1 | 1 |
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <pthread.h>
void *thread_function(void *arg);
pthread_mutex_t work_mutex;
pthread_cond_t work_cond;
#define WORK_SIZE 1024
char work_area[WORK_SIZE];
int time_to_exit = 0;
int main()
{
int res;
pthread_t a_thread;
void *thread_result;
... | 0 | 0 | 0 |
#include <pthread.h>
#include <stdio.h>
#include <stdlib.h>
#define NUM_THREADS 4
#define TOTAL_COUNT 10
#define COUNT_LIMIT 12
int count = 0;
pthread_mutex_t count_mutex;
pthread_cond_t count_threshold_cv;
void *inc_count(void *t)
{
int i;
long my_id = (long)t;
for (i = 0; i < TOTAL_COUNT; i++) {
... | 1 | 1 | 1 |
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <string.h>
#include <pthread.h>
#include <poll.h>
#include <errno.h>
static struct dlm_lksb lksb;
static int use_threads = 0;
static int quiet = 0;
static pthread_cond_t cond;
static pthread_mutex_t mutex;
static int ast_called = 0;
static int mod... | 0 | 0 | 0 |
#include <pthread.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <unistd.h>
#define FILE_SIZE 671088640 // 800 MB
#define BUFFER_SIZE 8
int thread_count = 0;
int server_file_des, bytes_read;
unsigned long long int block_size = 0, file_pos = 0, t... | 1 | 1 | 1 |
#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>
#include <string.h>
#include <pthread.h>
#include <signal.h>
#include <fcntl.h>
#include <unistd.h>
#include <sys/ioctl.h>
#include <sys/socket.h>
#include <arpa/inet.h>
#include <linux/videodev2.h>
int sockfd;
int cameraFd;
unsigned char *devconfp;
pthread_mu... | 0 | 1 | 1 |
#include <stdio.h>
#include <stdlib.h>
#include <pthread.h>
#include <semaphore.h>
#include <unistd.h>
#define THREADS_NUM 3
typedef struct List {
int value;
struct List *next;
} List;
struct List *lista = NULL;
pthread_mutex_t mutex;
sem_t sem;
void display(struct List *element) {
printf("[");
w... | 1 | 1 | 1 |
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <pthread.h>
#include <sys/socket.h>
#include <netdb.h>
#include <errno.h>
struct dns_discovery_args {
FILE *report;
char *domain;
int nthreads;
};
struct dns_discovery_args dd_args;
pthread_mutex_t mutexsum;
void error(const... | 0 | 0 | 0 |
#include <stdio.h>
#include <stdlib.h>
#include <pthread.h>
#include <time.h>
#include <math.h>
int MAX_NUMBER = 65535;
int max_m_operations = 200;
int thread_count = 8;
int initial_length = 10;
int seed =18;
double member_fraction = 0.80;
double insert_fraction = 0.10;
double delete_fraction = 0.10;
struct node** ... | 1 | 1 | 1 |
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <pthread.h>
#include <fcntl.h>
#include <string.h>
#include <assert.h>
#include <signal.h>
#include <stdbool.h>
#include <linux/input.h>
#include <mpd/client.h>
#include <stdarg.h>
#define MAX_CHANNEL 6
enum log_level {
DEBUG = 0,
INFO = 1,
... | 0 | 0 | 0 |
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <pthread.h>
#include <unistd.h>
#include <stdint.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include <fcntl.h>
static int fd;
static int disconnect;
static char *ip;
static char *port;
static uint... | 1 | 1 | 1 |
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <pthread.h>
#include <sys/socket.h>
#include <linux/netlink.h>
#include <errno.h>
struct udp_splice_handle {
pthread_mutex_t lock;
int sock;
uint16_t id;
};
static int udp_splice_get_family_id(int sock) {
struct {
... | 0 | 0 | 0 |
#include <stdio.h>
#include <stdlib.h>
#include <pthread.h>
#include <math.h>
#include <unistd.h>
#include <errno.h>
// Constants
#define CG_MAX 4
#define ND 4
#define X_MAX 4
#define Z_MAX 4
#define ROW 2
#define COL 2
#define d 1
// Global variables
pthread_mutex_t mut1, mut2;
pthread_cond_t cond1, cond2;
int g_sta... | 1 | 1 | 1 |
#include <stdlib.h>
#include <stdio.h>
#include <time.h>
#include <pthread.h>
#include <unistd.h>
pthread_mutex_t* f;
int* hungerOfPhylosophs;
int N;
void takeLeftFork(int);
void takeRightFork(int);
void putLeftFork(int);
void putRightFork(int);
void* meal(void*);
int main()
{
int Hunger, *Nums;
pthread_t* P... | 0 | 1 | 1 |
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <pthread.h>
#include <unistd.h>
#include <sys/time.h>
#include <fcntl.h>
#include <stdint.h>
#include <sys/stat.h>
#include <errno.h>
static char *root;
static int workers;
static int trials;
static int record_absolute;
static struct timeval asbolute... | 1 | 1 | 1 |
#include <stdio.h>
#include <pthread.h>
const int MAX_COUNT = 5;
typedef enum {PING_INIT, PING_READY, PONG_READY} READY;
READY g_ready = PING_INIT;
pthread_mutex_t thr_cond_lock = PTHREAD_MUTEX_INITIALIZER;
pthread_cond_t thr_cond = PTHREAD_COND_INITIALIZER;
void * thread_ping (void * arg)
{
int i = 0;
pthread_m... | 0 | 1 | 1 |
#include <stdio.h>
#include <stdlib.h>
#include <pthread.h>
#include <unistd.h>
#include <string.h>
int shared = 5;
pthread_mutex_t lock;
void sendreply(int replyfrompno, int replytopno, int ts) {
FILE *ptr;
char filename[10];
sprintf(filename, "file%d.txt", replytopno);
ptr = fopen(filename, "a");
... | 1 | 1 | 1 |
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <pthread.h>
#include <semaphore.h>
#include <sys/mman.h>
#include <time.h>
#include <fcntl.h>
#include <errno.h>
struct sema_mutex_args_struct {
sem_t* id;
pthread_mutex_t* mutex;
int* status;
pthread_barrier_t* barr;
};
void* mutex_k... | 0 | 0 | 0 |
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <pthread.h>
#include <sys/socket.h>
#include <sys/un.h>
#include <unistd.h>
#include <errno.h>
#include "uthash.h" // Ensure you have this library or similar hash table library available
#define TypeResponse 1
#define TypeRead 2
#define TypeWrite 3
s... | 1 | 0 | 0 |
#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>
#include <unistd.h>
#include <fcntl.h>
#include <sys/ioctl.h>
#include <pthread.h>
#include <linux/spi/spidev.h>
#include <string.h>
#include <errno.h>
#define SPI_MODE SPI_MODE_0
#define SPI_BITS_PER_WORD 8
#define SPI_SPEED_HZ 500000
#define SPI_DELAY 0
#de... | 0 | 0 | 0 |
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <pthread.h>
#include <time.h>
#include <stdbool.h>
static pthread_mutex_t lock = PTHREAD_MUTEX_INITIALIZER;
static unsigned int seed0;
static unsigned int seed1;
static int have_init = 0;
static int read_dev_random (void *buffer, size_t buffer_size)
... | 1 | 1 | 1 |
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <pthread.h>
#include <signal.h>
extern void skynet_logger_error(int, const char *, ...);
extern void skynet_logger_notice(int, const char *, ...);
extern void skynet_malloc(size_t);
extern void skynet_free(void *);
extern void sky... | 0 | 1 | 1 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.