示例#1
0
static void _save_dbd_state(void)
{
	char *dbd_fname;
	Buf buffer;
	int fd, rc, wrote = 0;
	uint16_t msg_type;
	uint32_t offset;

	dbd_fname = slurm_get_state_save_location();
	xstrcat(dbd_fname, "/dbd.messages");
	(void) unlink(dbd_fname);	/* clear save state */
	fd = open(dbd_fname, O_WRONLY | O_CREAT | O_TRUNC, 0600);
	if (fd < 0) {
		error("slurmdbd: Creating state save file %s", dbd_fname);
	} else if (agent_list && list_count(agent_list)) {
		char curr_ver_str[10];
		snprintf(curr_ver_str, sizeof(curr_ver_str),
			 "VER%d", SLURM_PROTOCOL_VERSION);
		buffer = init_buf(strlen(curr_ver_str));
		packstr(curr_ver_str, buffer);
		rc = _save_dbd_rec(fd, buffer);
		free_buf(buffer);
		if (rc != SLURM_SUCCESS)
			goto end_it;

		while ((buffer = list_dequeue(agent_list))) {
			/*
			 * We do not want to store registration messages. If an
			 * admin puts in an incorrect cluster name we can get a
			 * deadlock unless they add the bogus cluster name to
			 * the accounting system.
			 */
			offset = get_buf_offset(buffer);
			if (offset < 2) {
				free_buf(buffer);
				continue;
			}
			set_buf_offset(buffer, 0);
			(void) unpack16(&msg_type, buffer);  /* checked by offset */
			set_buf_offset(buffer, offset);
			if (msg_type == DBD_REGISTER_CTLD) {
				free_buf(buffer);
				continue;
			}

			rc = _save_dbd_rec(fd, buffer);
			free_buf(buffer);
			if (rc != SLURM_SUCCESS)
				break;
			wrote++;
		}
	}

end_it:
	if (fd >= 0) {
		verbose("slurmdbd: saved %d pending RPCs", wrote);
		(void) close(fd);
	}
	xfree(dbd_fname);
}
示例#2
0
static void smartcard_free(DEVICE* dev)
{
	IRP* irp;
	COMPLETIONIDINFO* CompletionIdInfo;
	SMARTCARD_DEVICE* smartcard = (SMARTCARD_DEVICE*) dev;

	SetEvent(smartcard->stopEvent);
	WaitForSingleObject(smartcard->thread, INFINITE);

	while ((irp = (IRP*) InterlockedPopEntrySList(smartcard->pIrpList)) != NULL)
		irp->Discard(irp);

	_aligned_free(smartcard->pIrpList);

	/* Begin TS Client defect workaround. */

	while ((CompletionIdInfo = (COMPLETIONIDINFO*) list_dequeue(smartcard->CompletionIds)) != NULL)
		free(CompletionIdInfo);

	CloseHandle(smartcard->thread);
	CloseHandle(smartcard->irpEvent);
	CloseHandle(smartcard->stopEvent);
	CloseHandle(smartcard->CompletionIdsMutex);

	Stream_Free(smartcard->device.data, TRUE);
	list_free(smartcard->CompletionIds);

	/* End TS Client defect workaround. */

	free(dev);
}
示例#3
0
/*
 *  Enqueues data [x] at the tail of queue [l].
 *  Returns the data's ptr, or lsd_nomem_error() if insertion failed.
 *
 *  void * list_enqueue (List l, void *x);
 *  -----------------------------------
 *  Dequeues the data item at the head of the queue [l].
 *  Returns the data's ptr, or NULL if the queue is empty.
 *
 *  void * list_dequeue (List l);
 */
void list_enqueue_dequeue()
{
	int i, j;
	char buf[32];
	List target_list = NULL;
	stu_t *node = NULL;
	ListIterator it = NULL;

	/* create target_list and append its elements */
	target_list = list_create(_list_delete_node_f);

	for (i = 0; i < 10; i++) {
		node = xmalloc(sizeof(stu_t));
		node->id = (90000L+i);
		node->age = i;
		sprintf(buf, "stu_%d", i);
		node->name = xstrdup(buf);
		/* list_enqueue */
		list_enqueue (target_list, (void *)node);
	}

	/* list_dequeue, and free the node using _list_delete_node_f */
	while (NULL != (node = (stu_t*)list_dequeue(target_list))) {
		printf("id = %ld, age = %f, name = %s\n", node->id, node->age, node->name);
		_list_delete_node_f(node);
	}

	printf("after list_dequeue, the count = %d\n", list_count(target_list));
	/* list_destroy : destroy the list */
	list_destroy (target_list);
}
示例#4
0
void dvcman_free(IWTSVirtualChannelManager* pChannelMgr)
{
	int i;
	IWTSPlugin* pPlugin;
	DVCMAN_LISTENER* listener;
	DVCMAN_CHANNEL* channel;
	DVCMAN* dvcman = (DVCMAN*) pChannelMgr;

	while ((channel = (DVCMAN_CHANNEL*) list_dequeue(dvcman->channels)) != NULL)
		dvcman_channel_free(channel);

	list_free(dvcman->channels);

	for (i = 0; i < dvcman->num_listeners; i++)
	{
		listener = (DVCMAN_LISTENER*) dvcman->listeners[i];
		xfree(listener->channel_name);
		xfree(listener);
	}

	for (i = 0; i < dvcman->num_plugins; i++)
	{
		pPlugin = dvcman->plugins[i];

		if (pPlugin->Terminated)
			pPlugin->Terminated(pPlugin);
	}

	xfree(dvcman);
}
示例#5
0
/**
 * called only from main thread
 */
static void freerdp_channels_process_sync(rdpChannels* chan_man, freerdp* instance)
{
	rdpChannel* lrdp_chan;
	struct sync_data* item;
	struct channel_data* lchan_data;

	while (chan_man->sync_data_list->head != NULL)
	{
		freerdp_mutex_lock(chan_man->sync_data_mutex);
		item = (struct sync_data*)list_dequeue(chan_man->sync_data_list);
		freerdp_mutex_unlock(chan_man->sync_data_mutex);

		lchan_data = chan_man->chans + item->index;
		lrdp_chan = freerdp_channels_find_channel_by_name(chan_man, instance->settings,
			lchan_data->name, &item->index);

		if (lrdp_chan != NULL)
			instance->SendChannelData(instance, lrdp_chan->channel_id, item->data, item->data_length);

		if (lchan_data->open_event_proc != 0)
		{
			lchan_data->open_event_proc(lchan_data->open_handle,
				CHANNEL_EVENT_WRITE_COMPLETE,
				item->user_data, sizeof(void *), sizeof(void *), 0);
		}
		xfree(item);
	}
}
示例#6
0
int		zt_build_command(t_list *pckts, char **cmd)
{
  t_list	frags;
  char		*frag;
  bool		failure;

  failure = false;
  list_ctor(&frags, &free);
  while (!failure && (frag = list_pop(pckts)))
    {
      if (strchr(frag, '\n'))
	{
	  if (split(pckts, &frags, frag) == RET_FAILURE ||
	      build(&frags, cmd) == RET_FAILURE)
	    failure = true;
	  break;
	}
      else if (list_enqueue(&frags, frag) == RET_FAILURE)
	failure = true;
    }
  while ((frag = list_dequeue(&frags)))
    list_push(pckts, frag);
  list_dtor(&frags);
  return (failure ? RET_FAILURE : RET_SUCCESS);
}
示例#7
0
static void svc_plugin_process_data_in(rdpSvcPlugin* plugin)
{
	svc_data_in_item* item;

	while (1)
	{
		/* terminate signal */
		if (freerdp_thread_is_stopped(plugin->priv->thread))
			break;

		freerdp_thread_lock(plugin->priv->thread);
		item = list_dequeue(plugin->priv->data_in_list);
		freerdp_thread_unlock(plugin->priv->thread);

		if (item != NULL)
		{
			/* the ownership of the data is passed to the callback */
			if (item->data_in)
				IFCALL(plugin->receive_callback, plugin, item->data_in);
			if (item->event_in)
				IFCALL(plugin->event_callback, plugin, item->event_in);
			xfree(item);
		}
		else
			break;
	}
}
示例#8
0
文件: wtsvc.c 项目: railmeat/FreeRDP
boolean WTSVirtualChannelRead(
    /* __in */  void* hChannelHandle,
    /* __in */  uint32 TimeOut,
    /* __out */ uint8* Buffer,
    /* __in */  uint32 BufferSize,
    /* __out */ uint32* pBytesRead)
{
    wts_data_item* item;
    rdpPeerChannel* channel = (rdpPeerChannel*) hChannelHandle;

    item = (wts_data_item*) list_peek(channel->receive_queue);
    if (item == NULL)
    {
        wait_obj_clear(channel->receive_event);
        *pBytesRead = 0;
        return true;
    }
    *pBytesRead = item->length;
    if (item->length > BufferSize)
        return false;

    /* remove the first element (same as what we just peek) */
    freerdp_mutex_lock(channel->mutex);
    list_dequeue(channel->receive_queue);
    if (list_size(channel->receive_queue) == 0)
        wait_obj_clear(channel->receive_event);
    freerdp_mutex_unlock(channel->mutex);

    memcpy(Buffer, item->buffer, item->length);
    wts_data_item_free(item) ;

    return true;
}
示例#9
0
文件: wtsvc.c 项目: railmeat/FreeRDP
boolean WTSVirtualChannelClose(
    /* __in */ void* hChannelHandle)
{
    wts_data_item* item;
    rdpPeerChannel* channel = (rdpPeerChannel*) hChannelHandle;

    if (channel != NULL)
    {
        if (channel->index < channel->client->settings->num_channels)
            channel->client->settings->channels[channel->index].handle = NULL;
        stream_free(channel->receive_data);
        if (channel->receive_event)
            wait_obj_free(channel->receive_event);
        if (channel->receive_queue)
        {
            while ((item = (wts_data_item*) list_dequeue(channel->receive_queue)) != NULL)
            {
                wts_data_item_free(item);
            }
            list_free(channel->receive_queue);
        }
        if (channel->mutex)
            freerdp_mutex_free(channel->mutex);
        xfree(channel);
    }

    return true;
}
示例#10
0
static void svc_plugin_process_terminated(rdpSvcPlugin* plugin)
{
	svc_data_in_item* item;

	freerdp_thread_stop(plugin->priv->thread);

	plugin->channel_entry_points.pVirtualChannelClose(plugin->priv->open_handle);
	xfree(plugin->channel_entry_points.pExtendedData);

	svc_plugin_remove(plugin);

	while ((item = list_dequeue(plugin->priv->data_in_list)) != NULL)
		svc_data_in_item_free(item);
	list_free(plugin->priv->data_in_list);

	if (plugin->priv->data_in != NULL)
	{
		stream_free(plugin->priv->data_in);
		plugin->priv->data_in = NULL;
	}
	xfree(plugin->priv);
	plugin->priv = NULL;

	IFCALL(plugin->terminate_callback, plugin);
}
示例#11
0
文件: buffer.c 项目: abhaykadam/vm
void net_buffer_extract(struct net_buffer_t *buffer, struct net_msg_t *msg)
{
	struct net_t *net = buffer->net;
	struct net_node_t *node = buffer->node;

	assert(buffer->count >= msg->size);
	buffer->count -= msg->size;

	/* Extract message from list */
	if (!list_count(buffer->msg_list))
		panic("%s: empty message list", __FUNCTION__);
	if (list_dequeue(buffer->msg_list) != msg)
		panic("%s: message is not at buffer head", __FUNCTION__);

	/* Update occupancy stat */
	net_buffer_update_occupancy(buffer);

	/* Debug */
	net_debug("buf "
		"a=\"extract\" "
		"net=\"%s\" "
		"msg=%lld "
		"node=\"%s\" "
		"buf=\"%s\"\n",
		net->name,
		msg->id,
		node->name,
		buffer->name);

	/* Schedule events waiting for space in buffer. */
	net_buffer_wakeup(buffer);
}
示例#12
0
void ai_eval_hexes( int x, int y, int range, int(*eval_func)(int,int,void*), void *ctx )
{
    List *list = list_create( LIST_NO_AUTO_DELETE, LIST_NO_CALLBACK );
    AI_Pos *pos;
    int i, nx, ny;
    /* gather and handle all positions by breitensuche.
       use AUX mask to mark visited positions */
    map_clear_mask( F_AUX );
    list_add( list, ai_create_pos( x, y ) ); mask[x][y].aux = 1;
    list_reset( list );
    while ( list->count > 0 ) {
        pos = list_dequeue( list );
        if ( !eval_func( pos->x, pos->y, ctx ) ) {
            free( pos );
            break;
        }
        for ( i = 0; i < 6; i++ )
            if ( get_close_hex_pos( pos->x, pos->y, i, &nx, &ny ) )
                if ( !mask[nx][ny].aux && get_dist( x, y, nx, ny ) <= range ) {
                    list_add( list, ai_create_pos( nx, ny ) );
                    mask[nx][ny].aux = 1;
                }
        free( pos );
    }
    list_delete( list );
}
示例#13
0
BOOL WTSVirtualChannelClose(
	/* __in */ void* hChannelHandle)
{
	wStream* s;
	wts_data_item* item;
	WTSVirtualChannelManager* vcm;
	rdpPeerChannel* channel = (rdpPeerChannel*) hChannelHandle;

	if (channel)
	{
		vcm = channel->vcm;

		if (channel->channel_type == RDP_PEER_CHANNEL_TYPE_SVC)
		{
			if (channel->index < channel->client->settings->ChannelCount)
				channel->client->settings->ChannelDefArray[channel->index].handle = NULL;
		}
		else
		{
			WaitForSingleObject(vcm->mutex, INFINITE);
			list_remove(vcm->dvc_channel_list, channel);
			ReleaseMutex(vcm->mutex);

			if (channel->dvc_open_state == DVC_OPEN_STATE_SUCCEEDED)
			{
				s = stream_new(8);
				wts_write_drdynvc_header(s, CLOSE_REQUEST_PDU, channel->channel_id);
				WTSVirtualChannelWrite(vcm->drdynvc_channel, stream_get_head(s), stream_get_length(s), NULL);
				stream_free(s);
			}
		}

		if (channel->receive_data)
			stream_free(channel->receive_data);

		if (channel->receive_event)
			CloseHandle(channel->receive_event);

		if (channel->receive_queue)
		{
			while ((item = (wts_data_item*) list_dequeue(channel->receive_queue)) != NULL)
			{
				wts_data_item_free(item);
			}

			list_free(channel->receive_queue);
		}

		if (channel->mutex)
			CloseHandle(channel->mutex);

		free(channel);
	}

	return TRUE;
}
示例#14
0
文件: pipe.c 项目: klange/ponyos
static void pipe_alert_waiters(pipe_device_t * pipe) {
	if (pipe->alert_waiters) {
		while (pipe->alert_waiters->head) {
			node_t * node = list_dequeue(pipe->alert_waiters);
			process_t * p = node->value;
			process_alert_node(p, pipe);
			free(node);
		}
	}
}
示例#15
0
static void urdp_pdf_free_printer(rdpPrinter* printer) {
	rdpPrintJob* printjob;

	while ((printjob = list_dequeue(((urdpPdfPrinter*) printer)->jobs)) != NULL) {
		urdp_pdf_close_printjob(printjob);
	}
	list_free(((urdpPdfPrinter*) printer)->jobs);
	xfree(printer->name);
	xfree(printer);
}
示例#16
0
/* Dequeue a command */
struct cuda_stream_command_t *cuda_stream_dequeue(CUstream stream) {
  struct cuda_stream_command_t *command;

  pthread_mutex_lock(&stream->lock);

  command = list_dequeue(stream->command_list);

  pthread_mutex_unlock(&stream->lock);

  return command;
}
示例#17
0
文件: devman.c 项目: LK2000/FreeRDP
void devman_free(DEVMAN* devman)
{
	DEVICE* device;

	while ((device = (DEVICE*) list_dequeue(devman->devices)) != NULL)
		IFCALL(device->Free, device);

	list_free(devman->devices);

	free(devman);
}
示例#18
0
static void serial_free(DEVICE* device)
{
    SERIAL_DEVICE* serial = (SERIAL_DEVICE*)device;
    IRP* irp;

    DEBUG_SVC("freeing device");

    freerdp_thread_stop(serial->thread);
    freerdp_thread_free(serial->thread);

    while ((irp = (IRP*)list_dequeue(serial->irp_list)) != NULL)
        irp->Discard(irp);
    list_free(serial->irp_list);

    while ((irp = (IRP*)list_dequeue(serial->pending_irps)) != NULL)
        irp->Discard(irp);
    list_free(serial->pending_irps);

    xfree(serial);
}
示例#19
0
文件: rtl.c 项目: Saruta/ToyOS
void* rtl_dequeue() {
	while (!net_queue->length) {
		sleep_on(rx_wait);
	}

	spin_lock(net_queue_lock);
	node_t * n = list_dequeue(net_queue);
	void* value = (struct ethernet_packet *)n->value;
	free(n);
	spin_unlock(net_queue_lock);

	return value;
}
示例#20
0
// NOTE: 10エントリ取り出す関数
void *get_ten_entries(void *arg) {
  struct list *list = (struct list *)arg;
  struct entry *entry;
  int i = 0;

  for (i = 0; i < 10; i++) {
    entry = list_dequeue(list);
    dequeue_count++;
    printf("Dequeue %d回目 : %s\n", dequeue_count, (char *)entry->data);
    free(entry->data);
    free(entry);
  }
}
示例#21
0
static void
scard_free(DEVICE* dev)
{
	SCARD_DEVICE* scard = (SCARD_DEVICE*)dev;
	IRP* irp;
	COMPLETIONIDINFO* CompletionIdInfo;

	freerdp_thread_stop(scard->thread);
	freerdp_thread_free(scard->thread);
	
	while ((irp = (IRP*)list_dequeue(scard->irp_list)) != NULL)
		irp->Discard(irp);
	list_free(scard->irp_list);

	/* Begin TS Client defect workaround. */
	while ((CompletionIdInfo = (COMPLETIONIDINFO*)list_dequeue(scard->CompletionIds)) != NULL)
	        xfree(CompletionIdInfo);
	list_free(scard->CompletionIds);
	/* End TS Client defect workaround. */

	xfree(dev);
	return;
}
示例#22
0
文件: wtsvc.c 项目: celsius/FreeRDP
boolean WTSVirtualChannelClose(
	/* __in */ void* hChannelHandle)
{
	STREAM* s;
	wts_data_item* item;
	WTSVirtualChannelManager* vcm;
	rdpPeerChannel* channel = (rdpPeerChannel*) hChannelHandle;

	if (channel)
	{
		vcm = channel->vcm;

		if (channel->channel_type == RDP_PEER_CHANNEL_TYPE_SVC)
		{
			if (channel->index < channel->client->settings->num_channels)
				channel->client->settings->channels[channel->index].handle = NULL;
		}
		else
		{
			freerdp_mutex_lock(vcm->mutex);
			list_remove(vcm->dvc_channel_list, channel);
			freerdp_mutex_unlock(vcm->mutex);

			if (channel->dvc_open_state == DVC_OPEN_STATE_SUCCEEDED)
			{
				s = stream_new(8);
				wts_write_drdynvc_header(s, CLOSE_REQUEST_PDU, channel->channel_id);
				WTSVirtualChannelWrite(vcm->drdynvc_channel, stream_get_head(s), stream_get_length(s), NULL);
				stream_free(s);
			}
		}
		if (channel->receive_data)
			stream_free(channel->receive_data);
		if (channel->receive_event)
			wait_obj_free(channel->receive_event);
		if (channel->receive_queue)
		{
			while ((item = (wts_data_item*) list_dequeue(channel->receive_queue)) != NULL)
			{
				wts_data_item_free(item);
			}
			list_free(channel->receive_queue);
		}
		if (channel->mutex)
			freerdp_mutex_free(channel->mutex);
		xfree(channel);
	}
	return true;
}
示例#23
0
文件: irq.c 项目: tdz/opsys
void
remove_irq_handler(unsigned char irqno, struct irq_handler* irqh)
{
    bool ints_on = cli_if_on();

    list_dequeue(&irqh->irqh);

    if (list_is_empty(g_irq_handling.irqh + irqno)) {
        /* Remove interupt if we don't handle it
         * any longer. */
        g_irq_handling.disable_irq(irqno);
    }

    sti_if_on(ints_on);
}
示例#24
0
文件: sync.c 项目: bishisht/manrix
/* Unlock the sync object */
int syscall_sync_unlock(void *ptr, int sync_id)
{
	struct sync *sn;
	thread_t thr;

	sn = find_sync(current->proc->pid, sync_id);
	if(!sn)
		return -EINVAL;

	list_dequeue(&sn->wq, thr, runq, thread_t);
	thr->states = THREAD_RUNNING;
	enqueue_thread(thr);

	return 0;
}
示例#25
0
文件: emu.c 项目: ajithcj/miaow
int SIEmuRun(Emu *self)
{
	SIEmu *emu = asSIEmu(self);

	struct si_ndrange_t *ndrange;
	struct si_wavefront_t *wavefront;
	struct si_work_group_t *work_group;

	int wavefront_id;
	long work_group_id;

	if (!list_count(emu->running_work_groups) &&
		list_count(emu->waiting_work_groups))
	{
		work_group_id = (long)list_dequeue(emu->waiting_work_groups);
		list_enqueue(emu->running_work_groups, (void*)work_group_id);
	}

	/* For efficiency when no Southern Islands emulation is selected, 
	 * exit here if the list of existing ND-Ranges is empty. */
	if (!list_count(emu->running_work_groups))
		return FALSE;

	assert(emu->ndrange);
	ndrange = emu->ndrange;

	/* Instantiate the next work-group */
	work_group_id = (long)list_bottom(emu->running_work_groups);
	work_group = si_work_group_create(work_group_id, ndrange);

//	struct si_wavefront_t* wf = work_group->wavefronts[0];
//	struct si_work_item_t* wi = wf->work_items[62];
	//printf("Vsrc1 value V0: %d\n", wi->vreg[0].as_int);
	
	/* Execute the work-group to completion */
	while (!work_group->finished_emu)
	{
		SI_FOREACH_WAVEFRONT_IN_WORK_GROUP(work_group, wavefront_id)
		{
			wavefront = work_group->wavefronts[wavefront_id];

			if (wavefront->finished || wavefront->at_barrier)
				continue;

			/* Execute instruction in wavefront */
			si_wavefront_execute(wavefront);
		}
	}
示例#26
0
static void parallel_free(DEVICE* device)
{
    IRP* irp;
    PARALLEL_DEVICE* parallel = (PARALLEL_DEVICE*) device;

    DEBUG_SVC("freeing device");

    freerdp_thread_stop(parallel->thread);
    freerdp_thread_free(parallel->thread);

    while ((irp = (IRP*) list_dequeue(parallel->irp_list)) != NULL)
        irp->Discard(irp);

    list_free(parallel->irp_list);

    xfree(parallel);
}
示例#27
0
/*
 * ----- sam_free_incore_host_table -
 *
 * Free the entire incore client host table.
 */
void
sam_free_incore_host_table(sam_mount_t *mp)
{
	int i, j;
	client_entry_t *clp;
	sam_msg_array_t *tmep;

	if (mp->ms.m_clienti) {
		for (i = 0; i < SAM_INCORE_HOSTS_INDEX_SIZE; i++) {
			client_entry_t *chunkp;

			chunkp = mp->ms.m_clienti[i];
			mp->ms.m_clienti[i] = NULL;

			if (chunkp) {
				for (j = 0;
				    j < SAM_INCORE_HOSTS_TABLE_INC; j++) {
					/*
					 * Cleanup each client host entry.
					 */
					clp = &chunkp[j];
					mutex_destroy(&clp->cl_wrmutex);
					while ((tmep =
					    list_dequeue(&clp->queue.list)) !=
					    NULL) {
						kmem_cache_free(
						    samgt.msg_array_cache,
						    tmep);
					}
				}
				/*
				 * Free each chunk of the client hosts table.
				 */
				kmem_free((void *)chunkp,
				    SAM_INCORE_HOSTS_TABLE_INC *
				    sizeof (client_entry_t));
			}
		}
		/*
		 * Free the client host table index array.
		 */
		kmem_free((void *)mp->ms.m_clienti,
		    SAM_INCORE_HOSTS_INDEX_SIZE * sizeof (client_entry_t *));
		mp->ms.m_clienti = NULL;
	}
}
示例#28
0
static void
scard_process_irp_list(SCARD_DEVICE* scard)
{
	IRP *irp;

	while (!freerdp_thread_is_stopped(scard->thread))
	{
		freerdp_thread_lock(scard->thread);
		irp = (IRP *) list_dequeue(scard->irp_list);
		freerdp_thread_unlock(scard->thread);

		if (irp == NULL)
			break;

		scard_process_irp(scard, irp);
	}
}
示例#29
0
static void printer_process_irp_list(PRINTER_DEVICE* printer_dev) {
	IRP* irp;

	while (1) {
		if (freerdp_thread_is_stopped(printer_dev->thread))
			break;

		freerdp_thread_lock(printer_dev->thread);
		irp = (IRP*) list_dequeue(printer_dev->irp_list);
		freerdp_thread_unlock(printer_dev->thread);

		if (irp == NULL)
			break;

		printer_process_irp(printer_dev, irp);
	}
}
示例#30
0
static void printer_free(DEVICE* device) {
	PRINTER_DEVICE* printer_dev = (PRINTER_DEVICE*) device;
	IRP* irp;

	freerdp_thread_stop(printer_dev->thread);
	freerdp_thread_free(printer_dev->thread);

	while ((irp = (IRP*) list_dequeue(printer_dev->irp_list)) != NULL)
		irp->Discard(irp);
	list_free(printer_dev->irp_list);

	if (printer_dev->printer)
		printer_dev->printer->Free(printer_dev->printer);

	xfree(printer_dev->device.name);

	xfree(printer_dev);
}