aboutsummaryrefslogtreecommitdiffstats
path: root/toj/center/src/judge_manage.h
diff options
context:
space:
mode:
authorpzread <netfirewall@gmail.com>2013-04-02 19:09:10 +0800
committerpzread <netfirewall@gmail.com>2013-04-02 19:09:10 +0800
commit3c6abbe11d9f2d173020add74217af2d450a1d16 (patch)
tree1cbd2ffc3081d75f58d7a15cbdfdecc0aa8e69e7 /toj/center/src/judge_manage.h
parent5ecfc12aad9e7b6d43273de7aefd514e430fec49 (diff)
downloadtaiwan-online-judge-3c6abbe11d9f2d173020add74217af2d450a1d16.tar
taiwan-online-judge-3c6abbe11d9f2d173020add74217af2d450a1d16.tar.gz
taiwan-online-judge-3c6abbe11d9f2d173020add74217af2d450a1d16.tar.bz2
taiwan-online-judge-3c6abbe11d9f2d173020add74217af2d450a1d16.tar.lz
taiwan-online-judge-3c6abbe11d9f2d173020add74217af2d450a1d16.tar.xz
taiwan-online-judge-3c6abbe11d9f2d173020add74217af2d450a1d16.tar.zst
taiwan-online-judge-3c6abbe11d9f2d173020add74217af2d450a1d16.zip
Add problem cache update system. Fix UI scroll problem and bug
Diffstat (limited to 'toj/center/src/judge_manage.h')
-rw-r--r--toj/center/src/judge_manage.h60
1 files changed, 60 insertions, 0 deletions
diff --git a/toj/center/src/judge_manage.h b/toj/center/src/judge_manage.h
new file mode 100644
index 0000000..00abc22
--- /dev/null
+++ b/toj/center/src/judge_manage.h
@@ -0,0 +1,60 @@
+class manage_judgeth_info{
+public:
+ bool use_flag;
+ int thid;
+ char run_path[PATH_MAX + 1];
+ judge_submit_info *sub_info;
+ char res_data[JUDGE_RES_DATAMAX];
+ size_t res_len;
+
+ manage_judgeth_info(int thid){
+ this->use_flag = false;
+ this->thid = thid;
+ snprintf(this->run_path,sizeof(this->run_path),"tmp/run/%d",thid);
+ mkdir(this->run_path,0775);
+ this->sub_info = NULL;
+ this->res_len = 0;
+ }
+};
+
+static void manage_updatepro_th(void *data);
+static void manage_updatepro_cb(void *data);
+static void manage_unpackcode_th(void *data);
+static void manage_unpackcode_cb(void *data);
+static void manage_judge_th(void *data);
+static void manage_judge_cb(void *data);
+static int manage_queuejudge(judge_submit_info *sub_info);
+static int manage_judge(int subid,char *pro_path,char *code_path,char *run_path,int lang,char *set_data,char *res_data,size_t &res_len);
+
+static tpool *manage_tp;
+static int manage_judgk_modfd;
+static manage_judgeth_info *manage_judgepool[16];
+static tpool_static_fn *manage_updatepro_thfn;
+static tpool_static_fn *manage_updatepro_cbfn;
+static tpool_static_fn *manage_unpackcode_thfn;
+static tpool_static_fn *manage_unpackcode_cbfn;
+static tpool_static_fn *manage_judge_thfn;
+static tpool_static_fn *manage_judge_cbfn;
+static std::multimap<int,judge_submit_info*> manage_submap;
+
+int judge_manage_init();
+int judge_manage_updatedata();
+judge_pro_info* judge_manage_getprobyid(int proid);
+int judge_manage_getpro(judge_pro_info *pro_info);
+int judge_manage_putpro(judge_pro_info *pro_info);
+int judge_manage_updatepro(int proid,int cacheid,bool check_flag,judge_pro_info **update_pro_info);
+int judge_manage_done_updatepro(judge_pro_info *pro_info);
+int judge_manage_submit(int subid,int proid,int lang,char *set_data);
+int judge_manage_done_code(int subid);
+
+std::map<int,judge_pro_info*> judge_manage_promap;
+
+extern int tool_pack(char *pack_path,char *dir_path);
+extern int tool_unpack(char *pack_path,char *dir_path);
+extern int tool_cleardir(char *path);
+
+extern int judge_server_addtpool(tpool *tpinfo);
+extern int judge_server_setpro(std::vector<std::pair<int,int> > &pro_list);
+extern int judge_server_reqpro(int subid);
+extern int judge_server_reqcode(int subid);
+extern int judge_server_result(int subid,char *res_data,int res_len);