コード例 #1
0
ファイル: msvcp_main.c プロジェクト: AlexSteel/wine
BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved)
{
    TRACE("(0x%p, %d, %p)\n", hinstDLL, fdwReason, lpvReserved);

    switch (fdwReason)
    {
        case DLL_PROCESS_ATTACH:
            init_cxx_funcs();
            init_lockit();
            init_exception(hinstDLL);
            init_locale(hinstDLL);
            init_io(hinstDLL);
            init_misc(hinstDLL);
            break;
        case DLL_PROCESS_DETACH:
            if (lpvReserved) break;
            free_io();
            free_locale();
            free_lockit();
            free_misc();
            break;
    }

    return TRUE;
}
コード例 #2
0
ファイル: pfiled.c プロジェクト: cnanakos/archipelago
void *io_loop(void *arg)
{
	struct io *io = (struct io *) arg;
	struct pfiled *pfiled = io->pfiled;
	struct xseg *xseg = pfiled->xseg;
	uint32_t portno = pfiled->portno;
	struct xseg_request *accepted;

	for (;;) {
		accepted = NULL;
		if (!isTerminate())
			accepted = xseg_accept(xseg, portno, 0);
		if (accepted) {
			io->req = accepted;
			wake_up_next_iothread(pfiled);
			handle_accepted(pfiled, io);
		}
		else {
			pthread_mutex_lock(&io->lock);
			free_io(pfiled, io);
			pthread_cond_wait(&io->cond, &io->lock);
			pthread_mutex_unlock(&io->lock);
		}
	}

	return NULL;
}
コード例 #3
0
ファイル: dm.c プロジェクト: wxlong/Test
/*
 * Decrements the number of outstanding ios that a bio has been
 * cloned into, completing the original io if necc.
 */
static inline void dec_pending(struct dm_io *io, int error)
{
	if (error)
		io->error = error;

	if (atomic_dec_and_test(&io->io_count)) {
		if (atomic_dec_and_test(&io->md->pending))
			/* nudge anyone waiting on suspend queue */
			wake_up(&io->md->wait);

		bio_endio(io->bio, io->bio->bi_size, io->error);
		free_io(io->md, io);
	}
}
コード例 #4
0
/*
 * Decrements the number of outstanding ios that a bio has been
 * cloned into, completing the original io if necc.
 */
static void dec_pending(struct dm_io *io, int error)
{
	if (error)
		io->error = error;

	if (atomic_dec_and_test(&io->io_count)) {
		if (end_io_acct(io))
			/* nudge anyone waiting on suspend queue */
			wake_up(&io->md->wait);

		blk_add_trace_bio(io->md->queue, io->bio, BLK_TA_COMPLETE);

		bio_endio(io->bio, io->bio->bi_size, io->error);
		free_io(io->md, io);
	}
}
コード例 #5
0
ファイル: msvcp71.c プロジェクト: PatroxGaurab/wine
BOOL WINAPI DllMain(HINSTANCE hdll, DWORD reason, LPVOID reserved)
{
    switch (reason)
    {
        case DLL_WINE_PREATTACH:
            return FALSE;  /* prefer native version */
        case DLL_PROCESS_ATTACH:
            init_cxx_funcs();
            init_lockit();
            init_exception(hdll);
            init_locale(hdll);
            init_io(hdll);
            break;
        case DLL_PROCESS_DETACH:
            free_io();
            free_locale();
            free_lockit();
            break;
    }
    return TRUE;
}
コード例 #6
0
ファイル: dm.c プロジェクト: 3sOx/asuswrt-merlin
/*
 * Decrements the number of outstanding ios that a bio has been
 * cloned into, completing the original io if necc.
 */
static void dec_pending(struct dm_io *io, int error)
{
	unsigned long flags;

	/* Push-back supersedes any I/O errors */
	if (error && !(io->error > 0 && __noflush_suspending(io->md)))
		io->error = error;

	if (atomic_dec_and_test(&io->io_count)) {
		if (io->error == DM_ENDIO_REQUEUE) {
			/*
			 * Target requested pushing back the I/O.
			 * This must be handled before the sleeper on
			 * suspend queue merges the pushback list.
			 */
			spin_lock_irqsave(&io->md->pushback_lock, flags);
			if (__noflush_suspending(io->md))
				bio_list_add(&io->md->pushback, io->bio);
			else
				/* noflush suspend was interrupted. */
				io->error = -EIO;
			spin_unlock_irqrestore(&io->md->pushback_lock, flags);
		}

		if (end_io_acct(io))
			/* nudge anyone waiting on suspend queue */
			wake_up(&io->md->wait);

		if (io->error != DM_ENDIO_REQUEUE) {
			blk_add_trace_bio(io->md->queue, io->bio,
					  BLK_TA_COMPLETE);

			bio_endio(io->bio, io->bio->bi_size, io->error);
		}

		free_io(io->md, io);
	}
}
コード例 #7
0
ファイル: msvcp90_main.c プロジェクト: bpowers/wine
BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved)
{
    TRACE("(0x%p, %d, %p)\n", hinstDLL, fdwReason, lpvReserved);

    switch (fdwReason)
    {
        case DLL_WINE_PREATTACH:
            return FALSE;    /* prefer native version */
        case DLL_PROCESS_ATTACH:
            init_cxx_funcs();
            init_lockit();
            init_exception(hinstDLL);
            init_locale(hinstDLL);
            init_io(hinstDLL);
            break;
        case DLL_PROCESS_DETACH:
            free_io();
            free_locale();
            free_lockit();
            break;
    }

    return TRUE;
}