This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package workdays | |
import ( | |
"encoding/json" | |
"fmt" | |
"io" | |
"net/http" | |
"os" | |
"path/filepath" | |
"time" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include "fifo_cache.hpp" | |
tFifoCache::~tFifoCache() | |
{ | |
if (p_cache_buffer != reinterpret_cast<char *>(-1)) | |
{ | |
int nRet = ::shmdt(p_cache_buffer); | |
if (0 != nRet) | |
{ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdlib.h> | |
#include <unistd.h> | |
#include <pthread.h> | |
#include <stdio.h> | |
#include <semaphore.h> | |
#define NUM 5 | |
int queue[NUM]; | |
sem_t blank_number, product_number; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdlib.h> | |
#include <unistd.h> | |
#include <pthread.h> | |
#include <stdio.h> | |
struct msg { | |
struct msg *next; | |
int num; | |
}; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
#include <stdlib.h> | |
#include <pthread.h> | |
#define NLOOP 5000 | |
pthread_mutex_t counter_mutex = PTHREAD_MUTEX_INITIALIZER; | |
int counter; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
#include <ucontext.h> | |
#include <list> | |
static void one(); | |
static void two(); | |
static void three(); | |
static ucontext_t ctx1; | |
static ucontext_t ctx2; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
##### |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
#define ROW 5 | |
#define COLUMN (ROW + 1) | |
static unsigned ix; | |
static unsigned iy; | |
static unsigned ctr = 1; | |
static unsigned sta = 0; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[server] | |
ip = 10.0.2.15 | |
port = 11000 | |
[client] | |
seq = 123456 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# define server map: {name : weight} | |
server_index = {0:'A', 1:'B', 2:'C'} | |
server_weight = {'A':4, 'B':3, 'C':2} | |
# global varibles | |
# server index is initialized with -1 | |
# current weight is the current weight in scheduling, and current weight is initialized with 0 | |
g_server_index = -1 | |
g_current_weight = 0 |
NewerOlder