当前位置: 首页>>代码示例>>C++>>正文


C++ REDIS_NOTUSED函数代码示例

本文整理汇总了C++中REDIS_NOTUSED函数的典型用法代码示例。如果您正苦于以下问题:C++ REDIS_NOTUSED函数的具体用法?C++ REDIS_NOTUSED怎么用?C++ REDIS_NOTUSED使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了REDIS_NOTUSED函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: REDIS_NOTUSED

void *IOThreadEntryPoint(void *arg) {
    iojob *j;
    listNode *ln;
    REDIS_NOTUSED(arg);

    pthread_detach(pthread_self());
    while(1) {
        /* Get a new job to process */
        lockThreadedIO();
        if (listLength(server.io_newjobs) == 0) {
            /* No new jobs in queue, exit. */
            redisLog(REDIS_DEBUG,"Thread %ld exiting, nothing to do",
                (long) pthread_self());
            server.io_active_threads--;
            unlockThreadedIO();
            return NULL;
        }
        ln = listFirst(server.io_newjobs);
        j = ln->value;
        listDelNode(server.io_newjobs,ln);
        /* Add the job in the processing queue */
        j->thread = pthread_self();
        listAddNodeTail(server.io_processing,j);
        ln = listLast(server.io_processing); /* We use ln later to remove it */
        unlockThreadedIO();
        redisLog(REDIS_DEBUG,"Thread %ld got a new job (type %d): %p about key '%s'",
            (long) pthread_self(), j->type, (void*)j, (char*)j->key->ptr);

        /* Process the Job */
        if (j->type == REDIS_IOJOB_LOAD) {
            vmpointer *vp = (vmpointer*)j->id;
            j->val = vmReadObjectFromSwap(j->page,vp->vtype);
        } else if (j->type == REDIS_IOJOB_PREPARE_SWAP) {
            j->pages = rdbSavedObjectPages(j->val);
        } else if (j->type == REDIS_IOJOB_DO_SWAP) {
            if (vmWriteObjectOnSwap(j->val,j->page) == REDIS_ERR)
                j->canceled = 1;
        }

        /* Done: insert the job into the processed queue */
        redisLog(REDIS_DEBUG,"Thread %ld completed the job: %p (key %s)",
            (long) pthread_self(), (void*)j, (char*)j->key->ptr);

        lockThreadedIO();
        listDelNode(server.io_processing,ln);
        listAddNodeTail(server.io_processed,j);
        unlockThreadedIO();

        /* Signal the main thread there is new stuff to process */
        redisAssert(write(server.io_ready_pipe_write,"x",1) == 1);
    }
    return NULL; /* never reached */
}
开发者ID:ambakshi,项目名称:redis,代码行数:53,代码来源:vm.c

示例2: execBlockClientOnSwappedKeys

/* Preload keys needed to execute the entire MULTI/EXEC block.
 *
 * This function is called by blockClientOnSwappedKeys when EXEC is issued,
 * and will block the client when any command requires a swapped out value. */
void execBlockClientOnSwappedKeys(redisClient *c, struct redisCommand *cmd, int argc, robj **argv) {
    int i, margc;
    struct redisCommand *mcmd;
    robj **margv;
    REDIS_NOTUSED(cmd);
    REDIS_NOTUSED(argc);
    REDIS_NOTUSED(argv);

    if (!(c->flags & REDIS_MULTI)) return;
    for (i = 0; i < c->mstate.count; i++) {
        mcmd = c->mstate.commands[i].cmd;
        margc = c->mstate.commands[i].argc;
        margv = c->mstate.commands[i].argv;

        if (mcmd->vm_preload_proc != NULL) {
            mcmd->vm_preload_proc(c,mcmd,margc,margv);
        } else {
            waitForMultipleSwappedKeys(c,mcmd,margc,margv);
        }
    }
}
开发者ID:ambakshi,项目名称:redis,代码行数:25,代码来源:vm.c

示例3: showThroughput

int showThroughput(struct aeEventLoop *eventLoop, long long id, void *clientData) {
    REDIS_NOTUSED(eventLoop);
    REDIS_NOTUSED(id);
    REDIS_NOTUSED(clientData);

    if (config.liveclients == 0) {
        fprintf(stderr,"All clients disconnected... aborting.\n");
        exit(1);
    }
    if (config.csv) return 250;
    if (config.idlemode == 1) {
        printf("clients: %d\r", config.liveclients);
        fflush(stdout);
	return 250;
    }
    float dt = (float)(mstime()-config.start)/1000.0;
    float rps = (float)config.requests_finished/dt;
    printf("%s: %.2f\r", config.title, rps);
    fflush(stdout);
    return 250; /* every 250ms */
}
开发者ID:weekend27,项目名称:Annotated-Redis,代码行数:21,代码来源:redis-benchmark.c

示例4: sigaction

/* Behaves as posix, works without ifdefs, makes compiler happy */
int sigaction(int sig, struct sigaction *in, struct sigaction *out) {
    REDIS_NOTUSED(out);

    /* When the SA_SIGINFO flag is set in sa_flags then sa_sigaction
    * is used. Otherwise, sa_handler is used */
    if (in->sa_flags & SA_SIGINFO) {
        signal(sig, in->sa_sigaction);
    } else {
        signal(sig, in->sa_handler);
    }
    return 0;
}
开发者ID:mz02005,项目名称:CScript,代码行数:13,代码来源:Win32_Signal_Process.c

示例5: writeHandler

static void writeHandler(aeEventLoop *el, int fd, void *privdata, int mask) {
    client c = privdata;
    REDIS_NOTUSED(el);
    REDIS_NOTUSED(fd);
    REDIS_NOTUSED(mask);

    /* Initialize request when nothing was written. */
    if (c->written == 0) {
        /* Enforce upper bound to number of requests. */
        if (config.requests_issued++ >= config.requests) {
            freeClient(c);
            return;
        }

        /* Really initialize: randomize keys and set start time. */
        if (config.randomkeys) randomizeClientKey(c);
        c->start = ustime();
        c->latency = -1;
    }

    if (sdslen(c->obuf) > c->written) {
        void *ptr = c->obuf+c->written;
#ifdef _WIN32
        int nwritten = send(c->context->fd,ptr,sdslen(c->obuf)-c->written, 0);
#else
        int nwritten = write(c->context->fd,ptr,sdslen(c->obuf)-c->written);
#endif
        if (nwritten == -1) {
            if (errno != EPIPE)
                fprintf(stderr, "Writing to socket: %s\n", strerror(errno));
            freeClient(c);
            return;
        }
        c->written += nwritten;
        if (sdslen(c->obuf) == c->written) {
            aeDeleteFileEvent(config.el,c->context->fd,AE_WRITABLE);
            aeCreateFileEvent(config.el,c->context->fd,AE_READABLE,readHandler,c);
        }
    }
}
开发者ID:ambakshi,项目名称:redis,代码行数:40,代码来源:redis-benchmark.c

示例6: readHandler

static void readHandler(aeEventLoop *el, int fd, void *privdata, int mask) {
    client c = privdata;
    void *reply = NULL;
    REDIS_NOTUSED(el);
    REDIS_NOTUSED(fd);
    REDIS_NOTUSED(mask);

    /* Calculate latency only for the first read event. This means that the
     * server already sent the reply and we need to parse it. Parsing overhead
     * is not part of the latency, so calculate it only once, here. */
    if (c->latency < 0) c->latency = ustime()-(c->start);

    if (redisBufferRead(c->context) != REDIS_OK) {
        fprintf(stderr,"Error: %s\n",c->context->errstr);
        exit(1);
    } else {
        while(c->pending) {
            if (redisGetReply(c->context,&reply) != REDIS_OK) {
                fprintf(stderr,"Error: %s\n",c->context->errstr);
                exit(1);
            }
            if (reply != NULL) {
                if (reply == (void*)REDIS_REPLY_ERROR) {
                    fprintf(stderr,"Unexpected error reply, exiting...\n");
                    exit(1);
                }

                freeReplyObject(reply);

                if (config.requests_finished < config.requests)
                    config.latency[config.requests_finished++] = c->latency;
                c->pending--;
                if (c->pending == 0) clientDone(c);
            } else {
                break;
            }
        }
    }
}
开发者ID:newappfirst,项目名称:ssl-redis,代码行数:39,代码来源:redis-benchmark.c

示例7: readFromSlave

void readFromSlave(aeEventLoop *el, int fd, void *privdata, int mask){
	REDIS_NOTUSED(el);
	REDIS_NOTUSED(mask);
	char rdata[MAX_READ];
	int nread = readData(el, fd, rdata, MAX_READ);
	if(nread <= 0 )
	{
		return;
	}
	if(nread == 6){
		rdata[6]= 0;
		char *sync = "SYNC\r\n";
		if(strcmp(sync, rdata) == 0){
			log4c_category_log(mycat, LOG4C_PRIORITY_INFO, "sync start");
			state = SYNC_START_STATE;
		}		
	}
	int wr = writeData(el, master_fd, rdata, nread);
	if(-1 == wr)
	{
		log4c_category_log(mycat, LOG4C_PRIORITY_ERROR, "write to master failed error %d, at line %d in file %s",  errno,  __LINE__, __FILE__);
	}
}
开发者ID:CowLeo,项目名称:LRUedRedisStorage-iceberg-,代码行数:23,代码来源:read_handler.c

示例8: luaMaskCountHook

void luaMaskCountHook(lua_State *lua, lua_Debug *ar) {
    long long elapsed;
    REDIS_NOTUSED(ar);
    REDIS_NOTUSED(lua);

    elapsed = mstime() - server.lua_time_start;
    if (elapsed >= server.lua_time_limit && server.lua_timedout == 0) {
        redisLog(REDIS_WARNING,"Lua slow script detected: still in execution after %lld milliseconds. You can try killing the script using the SCRIPT KILL command.",elapsed);
        server.lua_timedout = 1;
        /* Once the script timeouts we reenter the event loop to permit others
         * to call SCRIPT KILL or SHUTDOWN NOSAVE if needed. For this reason
         * we need to mask the client executing the script from the event loop.
         * If we don't do that the client may disconnect and could no longer be
         * here when the EVAL command will return. */
         aeDeleteFileEvent(server.el, server.lua_caller->fd, AE_READABLE);
    }
    if (server.lua_timedout) processEventsWhileBlocked();
    if (server.lua_kill) {
        redisLog(REDIS_WARNING,"Lua script killed by user with SCRIPT KILL.");
        lua_pushstring(lua,"Script killed by user with SCRIPT KILL...");
        lua_error(lua);
    }
}
开发者ID:wangxuemin,项目名称:coding,代码行数:23,代码来源:scripting.c

示例9: ctrlc

static void ctrlc(int sig) {
    REDIS_NOTUSED(sig);

    if (config.idlemode) {
        exit(1);
    } else {
        config.ctrlc++;
        if (config.ctrlc == 1) {
            config.done = 1;
            printf("\nWaiting for pending requests to complete...\n");
        } else {
            printf("\nForcing exit...\n");
            exit(1);
        }
    }
}
开发者ID:Dennsy,项目名称:redis-tools,代码行数:16,代码来源:redis-load.c

示例10: pthread_join

int pthread_join(pthread_t thread, void **value_ptr)  {
    int result;
    HANDLE h = OpenThread(SYNCHRONIZE, FALSE, thread);
    REDIS_NOTUSED(value_ptr);

    switch (WaitForSingleObject(h, INFINITE)) {
            case WAIT_OBJECT_0:
                    result = 0;
            case WAIT_ABANDONED:
                    result = EINVAL;
            default:
                    result = GetLastError();
    }

    CloseHandle(h);
    return result;
}
开发者ID:LichKing-lee,项目名称:nbase-arc,代码行数:17,代码来源:win32fixes.c

示例11: REDIS_NOTUSED

int *getKeysUsingCommandTable(struct redisCommand *cmd,robj **argv, int argc, int *numkeys) {
    int j, i = 0, last, *keys;
    REDIS_NOTUSED(argv);

    if (cmd->firstkey == 0) {
        *numkeys = 0;
        return NULL;
    }
    last = cmd->lastkey;
    if (last < 0) last = argc+last;
    keys = zmalloc(sizeof(int)*((last - cmd->firstkey)+1));
    for (j = cmd->firstkey; j <= last; j += cmd->keystep) {
        redisAssert(j < argc);
        keys[i++] = j;
    }
    *numkeys = i;
    return keys;
}
开发者ID:luxyer,项目名称:redis-storage,代码行数:18,代码来源:db.c

示例12: REDIS_NOTUSED

/* Helper function to extract keys from the following commands:
 * EVAL <script> <num-keys> <key> <key> ... <key> [more stuff]
 * EVALSHA <script> <num-keys> <key> <key> ... <key> [more stuff] */
int *evalGetKeys(struct redisCommand *cmd, robj **argv, int argc, int *numkeys) {
    int i, num, *keys;
    REDIS_NOTUSED(cmd);

    num = atoi(argv[2]->ptr);
    /* Sanity check. Don't return any key if the command is going to
     * reply with syntax error. */
    if (num > (argc-3)) {
        *numkeys = 0;
        return NULL;
    }

    keys = zmalloc(sizeof(int)*num);
    *numkeys = num;

    /* Add all key positions for argv[3...n] to keys[] */
    for (i = 0; i < num; i++) keys[i] = 3+i;

    return keys;
}
开发者ID:wenxueliu,项目名称:redis_comment,代码行数:23,代码来源:db.c

示例13: pthread_create

int pthread_create(pthread_t *thread, const void *unused,
           void *(*start_routine)(void*), void *arg) {
    HANDLE h;
    thread_params *params = (thread_params *)malloc(sizeof(thread_params));
    REDIS_NOTUSED(unused);

    params->func = start_routine;
    params->arg  = arg;

    h =(HANDLE) _beginthreadex(NULL,  /* Security not used */
                               REDIS_THREAD_STACK_SIZE, /* Set custom stack size */
                               win32_proxy_threadproc,  /* calls win32 stdcall proxy */
                               params, /* real threadproc is passed as paremeter */
                               STACK_SIZE_PARAM_IS_A_RESERVATION,  /* reserve stack */
                               thread /* returned thread id */
                );

    if (!h)
        return errno;

    CloseHandle(h);
    return 0;
}
开发者ID:LichKing-lee,项目名称:nbase-arc,代码行数:23,代码来源:win32fixes.c

示例14: pthread_cond_init

int pthread_cond_init(pthread_cond_t *cond, const void *unused) {
        REDIS_NOTUSED(unused);
        cond->waiters = 0;
        cond->was_broadcast = 0;

        InitializeCriticalSection(&cond->waiters_lock);

        cond->sema = CreateSemaphore(NULL, 0, LONG_MAX, NULL);
        if (!cond->sema) {
            errno = GetLastError();
            return -1;
        }

        cond->continue_broadcast = CreateEvent(NULL,    /* security */
                                FALSE,                  /* auto-reset */
                                FALSE,                  /* not signaled */
                                NULL);                  /* name */
        if (!cond->continue_broadcast) {
            errno = GetLastError();
            return -1;
        }

        return 0;
}
开发者ID:LichKing-lee,项目名称:nbase-arc,代码行数:24,代码来源:win32fixes.c

示例15: readFromMaster

void readFromMaster(aeEventLoop *el, int fd, void *privdata, int mask) {
	REDIS_NOTUSED(el);
	REDIS_NOTUSED(mask);
	int nread;
	char rdata[MAX_READ];
	char *p = rdata;
	switch(state){
		case SYNC_START_STATE:{	 
			while(1){
				nread = readData(el, fd, p,1);
				if(nread < 0){
					return;
				}
				else if(nread == 0){
					continue;
				}
	
				int wr = writeData(el, client_fd, p, 1);
				if(-1 == wr)
				{
					return;
				}
				if(*p == '\n' && p != rdata) break;
				if(*p != '\n') p++;
			}
			*p = '\0';
			if(rdata[0] == '-'){
				log4c_category_log(mycat, LOG4C_PRIORITY_ERROR, "sync with master failed at line %d in file %s",   __LINE__, __FILE__);
				exit(1);
			}
			bulk_size = strtoull(rdata + 1, 0, 10);
			log4c_category_log(mycat, LOG4C_PRIORITY_INFO, "bulk size %llu, at line %d in file %s",  bulk_size,  __LINE__, __FILE__);
			state = SYNC_STATE;
			break;
		} 
		case SYNC_STATE:{ 
			long long int all_read =0;
			long long int all_write =0;
			while(bulk_size){
				nread = readData(el, fd, rdata, (bulk_size > MAX_READ) ? MAX_READ:bulk_size);
				if(nread < 0 )
				{
					return;
				}
				else if (nread == 0){
					continue;
				}
				else{
					all_read += nread;
				}
				int wr = writeData(el, client_fd, rdata,nread);
				if(-1 == wr)
				{
					log4c_category_log(mycat, LOG4C_PRIORITY_ERROR, "write to payload failed error %d, at line %d in file %s",  errno,  __LINE__, __FILE__);
					return;
				}
				else{
					all_write += wr;
				}
				bulk_size -= nread;
			}
			state = RUNNING_STATE;		
			log4c_category_log(mycat, LOG4C_PRIORITY_INFO, "sync done");
			break;
		} 
		default:{ 
			nread = readData(el, fd, rdata, MAX_READ);
			if(nread > 0){
				struct WData wdata;
				wdata.len = nread;
				wdata.data= rdata; 
				if( state == RUNNING_STATE){
					processInputBuffer(el, &wdata);
					int wr = writeData(el, client_fd, wdata.data, wdata.len);
					if(-1 == wr)
					{
						return;
					}
				}
				else{
					if(nread > 9 && nread < 100)
					{
						if(!strncmp(rdata,"+CONTINUE",9) || !strncmp(rdata,"+FULLRESYNC",11)){
		
							log4c_category_log(mycat, LOG4C_PRIORITY_INFO, "sync start");
							state = SYNC_START_STATE;
						}
					}
					int wr = writeData(el, client_fd, wdata.data, wdata.len);
					if(-1 == wr)
					{
						return;
					}
		
				}
			}
			break; 
		} 
	}

//.........这里部分代码省略.........
开发者ID:CowLeo,项目名称:LRUedRedisStorage-iceberg-,代码行数:101,代码来源:read_handler.c


注:本文中的REDIS_NOTUSED函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。