예제 #1
0
void ci_service_set_istag(ci_service_xdata_t * srv_xdata, char *istag)
{
     ci_thread_rwlock_wrlock(&srv_xdata->lock);
     strncpy(srv_xdata->ISTag + SRV_ISTAG_POS, istag,
             SRV_ISTAG_SIZE - SRV_ISTAG_POS);
     srv_xdata->ISTag[SRV_ISTAG_SIZE] = '\0';
     ci_thread_rwlock_unlock(&srv_xdata->lock);
}
예제 #2
0
void ci_service_set_transfer_complete(ci_service_xdata_t * srv_xdata,
                                      char *complete)
{
     ci_thread_rwlock_wrlock(&srv_xdata->lock);
     strcpy(srv_xdata->TransferComplete, "Transfer-Complete: ");
     strncat(srv_xdata->TransferComplete, complete,
             MAX_HEADER_SIZE - sizeof("Transfer-Complete: "));
     ci_thread_rwlock_unlock(&srv_xdata->lock);
}
예제 #3
0
void ci_service_set_transfer_ignore(ci_service_xdata_t * srv_xdata,
                                    char *ignore)
{
     ci_thread_rwlock_wrlock(&srv_xdata->lock);
     strcpy(srv_xdata->TransferIgnore, "Transfer-Ignore: ");
     strncat(srv_xdata->TransferIgnore, ignore,
             MAX_HEADER_SIZE - sizeof("Transfer-Ignore: "));
     ci_thread_rwlock_unlock(&srv_xdata->lock);
}
예제 #4
0
void ci_service_set_transfer_preview(ci_service_xdata_t * srv_xdata,
                                     char *preview)
{
     ci_thread_rwlock_wrlock(&srv_xdata->lock);
     strcpy(srv_xdata->TransferPreview, "Transfer-Preview: ");
     strncat(srv_xdata->TransferPreview, preview,
             MAX_HEADER_SIZE - sizeof("Transfer-Preview: "));
     ci_thread_rwlock_unlock(&srv_xdata->lock);
}
int postInitImageClassificationService(void)
{
uint16_t category;
	ci_thread_rwlock_init(&imageclassify_rwlock);
	ci_thread_rwlock_wrlock(&imageclassify_rwlock);

	/*Initialize object pools*/
	IMAGEDETECTED_POOL = ci_object_pool_register("image_detected_t", sizeof(image_detected_t) * num_image_categories);

	if(IMAGEDETECTED_POOL < 0) {
		ci_debug_printf(1, " srvclassify_init_service: error registering object_pool image_detected_t\n");
		ci_thread_rwlock_unlock(&imageclassify_rwlock);
		return CI_ERROR;
	}

	IMAGEDETECTEDCOUNT_POOL = ci_object_pool_register("image_detected_count_t", sizeof(image_detected_count_t) * num_image_categories);

	if(IMAGEDETECTEDCOUNT_POOL < 0) {
		ci_debug_printf(1, " srvclassify_init_service: error registering object_pool image_detected_count_t\n");
		ci_object_pool_unregister(IMAGEDETECTED_POOL);
		ci_thread_rwlock_unlock(&imageclassify_rwlock);
		return CI_ERROR;
	}

	if(num_image_categories)
	{
		for(category = 0; category < num_image_categories; category++)
		{
			if(ci_thread_mutex_init(&imageCategories[category].mutex) != 0)
			{
				ci_debug_printf(1, "srv_classify_image: Couldn't init category mutex\n");
			}
			if(ci_thread_cond_init(&imageCategories[category].cond) != 0)
			{
				ci_debug_printf(1, "srv_classify_image: Couldn't init category condition lock variable\n");
			}
		}
	}

	ci_thread_rwlock_unlock(&imageclassify_rwlock);
	return CI_OK;
}
예제 #6
0
void ci_service_add_xincludes(ci_service_xdata_t * srv_xdata,
                              char **xincludes)
{
     int len, i;
     len = 0;
     i = 0;
     if (!xincludes)
          return;
     ci_thread_rwlock_wrlock(&srv_xdata->lock);
     while (XINCLUDES_SIZE - len - 2 > 0 && xincludes[i]) {
          if (len) {
               strcat(srv_xdata->xincludes, ", ");
               len += 2;
          }
          strncat(srv_xdata->xincludes, xincludes[i], XINCLUDES_SIZE - len);
          len += strlen(xincludes[i]);
          i++;
     }
     ci_thread_rwlock_unlock(&srv_xdata->lock);
}
예제 #7
0
void ci_service_set_xopts(ci_service_xdata_t * srv_xdata, uint64_t xopts)
{
     ci_thread_rwlock_wrlock(&srv_xdata->lock);
     srv_xdata->xopts = xopts;
     ci_thread_rwlock_unlock(&srv_xdata->lock);
}
예제 #8
0
void ci_service_set_max_connections(ci_service_xdata_t *srv_xdata, int max_connections)
{
    ci_thread_rwlock_wrlock(&srv_xdata->lock);
    srv_xdata->max_connections = max_connections;
    ci_thread_rwlock_unlock(&srv_xdata->lock);
}
예제 #9
0
void ci_service_enable_204(ci_service_xdata_t * srv_xdata)
{
     ci_thread_rwlock_wrlock(&srv_xdata->lock);
     srv_xdata->allow_204 = 1;
     ci_thread_rwlock_unlock(&srv_xdata->lock);
}
예제 #10
0
void ci_service_set_preview(ci_service_xdata_t * srv_xdata, int preview)
{
     ci_thread_rwlock_wrlock(&srv_xdata->lock);
     srv_xdata->preview_size = preview;
     ci_thread_rwlock_unlock(&srv_xdata->lock);
}
예제 #11
0
void ci_service_data_read_unlock(ci_service_xdata_t * srv_xdata)
{
     ci_thread_rwlock_unlock(&srv_xdata->lock);
}