コード例 #1
0
ファイル: rpc_sessionpool.c プロジェクト: believe3301/openrpc
rpc_sessionpool* rpc_sessionpool_new() {
	rpc_sessionpool *pool = rpc_new(rpc_sessionpool,1);
	pthread_mutex_init(&pool->mutex, NULL);
	pool->data = rpc_new0(pointer,POOLCAPACITY);
	pool->size = POOLCAPACITY;
	return pool;
}
コード例 #2
0
ファイル: rpc_array.c プロジェクト: believe3301/openrpc
rpc_array* rpc_array_new_size(int size) {
	rpc_array *array = rpc_new(rpc_array,1);
	pthread_mutex_init(&array->lock, NULL);
	array->data = rpc_new0(pointer,size );
	array->size = size;
	array->cur = 0;
	return array;
}
コード例 #3
0
ファイル: rpc_async_queue.c プロジェクト: believe3301/openrpc
rpc_async_queue* rpc_async_queue_new() {
	rpc_async_queue *queue = rpc_new(rpc_async_queue,1);
	pthread_mutex_init(&queue->mutex, NULL);
	pthread_cond_init(&queue->cond, NULL);
	queue->head = NULL;
	queue->tail = NULL;
	return queue;
}
コード例 #4
0
ファイル: rpc_base_thread.c プロジェクト: believe3301/openrpc
rpc_thread* rpc_thread_new(rpc_thread_func func) {
	rpc_thread *th = rpc_new(rpc_thread,1);
	th->func = func;
	pthread_t pid;
	if (pthread_create(&pid, NULL, rpc_thread_inner, th) == -1) {
		//go to
		rpc_free(th);
		return NULL;
	}
	th->pid = pid;
	th->finished = TRUE;
	return th;
}
コード例 #5
0
ファイル: rpc_response.c プロジェクト: believe3301/openrpc
rpc_response* rpc_response_new() {
	if (rpc_response_freelist == NULL) {
		pthread_mutex_lock(&freelock);
		if (rpc_response_freelist == NULL) {
			rpc_response_freelist = rpc_array_new();
		}
		pthread_mutex_unlock(&freelock);
	}
	//rpc_response *rsp = g_new(rpc_response,1);
	rpc_response *rsp = (rpc_response*) rpc_array_get(rpc_response_freelist);
	if (rsp == NULL) {
		rsp = rpc_new(rpc_response,1);
	}
	return rsp;
}
コード例 #6
0
ファイル: rpc_request.c プロジェクト: believe3301/openrpc
rpc_request* rpc_request_new() {
	if (rpc_request_freelist == NULL) {
		pthread_mutex_lock(&freelock);
		if (rpc_request_freelist == NULL) {
			rpc_request_freelist = rpc_array_new();
		}
		pthread_mutex_unlock(&freelock);
	}
	//rpc_request *req = g_new(rpc_request,1);
	rpc_request *req = (rpc_request*) rpc_array_get(rpc_request_freelist);
	if (req == NULL) {
		req = rpc_new(rpc_request,1);
	}
	return req;
}
コード例 #7
0
ファイル: reader.c プロジェクト: knusbaum/Wily
static int
connectWin(rdWin *w, char *filename)
{
	int fd;

	assert(w);
	if (filename == 0)
		filename = "New";
	if (rpc_new(wilyq, &w->id, filename, false) < 0) {
		DPRINT("Could not get new window from wily");
		freeWin(w);
		return -1;
	}
	return 0;
}
コード例 #8
0
ファイル: tsg.c プロジェクト: AlessioLeo/FreeRDP
rdpTsg* tsg_new(rdpTransport* transport)
{
	rdpTsg* tsg;

	tsg = (rdpTsg*) malloc(sizeof(rdpTsg));
	ZeroMemory(tsg, sizeof(rdpTsg));

	if (tsg != NULL)
	{
		tsg->transport = transport;
		tsg->settings = transport->settings;
		tsg->rpc = rpc_new(tsg->transport);
		tsg->PendingPdu = FALSE;
	}

	return tsg;
}
コード例 #9
0
ファイル: tsg.c プロジェクト: JozLes77/FreeRDP
rdpTsg* tsg_new(rdpTransport* transport)
{
	rdpTsg* tsg;

	tsg = (rdpTsg*) calloc(1, sizeof(rdpTsg));

	if (!tsg)
		return NULL;

	tsg->transport = transport;
	tsg->settings = transport->settings;
	tsg->rpc = rpc_new(tsg->transport);

	if (!tsg->rpc)
		goto out_free;

	tsg->PendingPdu = FALSE;
	return tsg;

out_free:
	free(tsg);
	return NULL;
}