- /* Ready to spawn our thread */
- if (pthread_create(&thread,&attr,bioProcessBackgroundJobs,NULL) != 0) {
- redisLog(REDIS_WARNING,"Fatal: Can't initialize Background Jobs.");
- exit(1);
+ /* Ready to spawn our threads. We use the single argument the thread
+ * function accepts in order to pass the job ID the thread is
+ * responsible of. */
+ for (j = 0; j < REDIS_BIO_NUM_OPS; j++) {
+ void *arg = (void*)(unsigned long) j;
+ if (pthread_create(&thread,&attr,bioProcessBackgroundJobs,arg) != 0) {
+ redisLog(REDIS_WARNING,"Fatal: Can't initialize Background Jobs.");
+ exit(1);
+ }