亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? winhandl.c

?? putty
?? C
?? 第 1 頁 / 共 2 頁
字號:
	SetEvent(ctx->ev_to_main);
	if (!writeret)
	    break;
    }

    return 0;
}

static void handle_try_output(struct handle_output *ctx)
{
    void *senddata;
    int sendlen;

    if (!ctx->busy && bufchain_size(&ctx->queued_data)) {
	bufchain_prefix(&ctx->queued_data, &senddata, &sendlen);
	ctx->buffer = senddata;
	ctx->len = sendlen;
	SetEvent(ctx->ev_from_main);
	ctx->busy = TRUE;
    }
}

/* ----------------------------------------------------------------------
 * Unified code handling both input and output threads.
 */

struct handle {
    int output;
    union {
	struct handle_generic g;
	struct handle_input i;
	struct handle_output o;
    } u;
};

static tree234 *handles_by_evtomain;

static int handle_cmp_evtomain(void *av, void *bv)
{
    struct handle *a = (struct handle *)av;
    struct handle *b = (struct handle *)bv;

    if ((unsigned)a->u.g.ev_to_main < (unsigned)b->u.g.ev_to_main)
	return -1;
    else if ((unsigned)a->u.g.ev_to_main > (unsigned)b->u.g.ev_to_main)
	return +1;
    else
	return 0;
}

static int handle_find_evtomain(void *av, void *bv)
{
    HANDLE *a = (HANDLE *)av;
    struct handle *b = (struct handle *)bv;

    if ((unsigned)*a < (unsigned)b->u.g.ev_to_main)
	return -1;
    else if ((unsigned)*a > (unsigned)b->u.g.ev_to_main)
	return +1;
    else
	return 0;
}

struct handle *handle_input_new(HANDLE handle, handle_inputfn_t gotdata,
				void *privdata, int flags)
{
    struct handle *h = snew(struct handle);
    DWORD in_threadid; /* required for Win9x */

    h->output = FALSE;
    h->u.i.h = handle;
    h->u.i.ev_to_main = CreateEvent(NULL, FALSE, FALSE, NULL);
    h->u.i.ev_from_main = CreateEvent(NULL, FALSE, FALSE, NULL);
    h->u.i.gotdata = gotdata;
    h->u.i.defunct = FALSE;
    h->u.i.moribund = FALSE;
    h->u.i.done = FALSE;
    h->u.i.privdata = privdata;
    h->u.i.flags = flags;

    if (!handles_by_evtomain)
	handles_by_evtomain = newtree234(handle_cmp_evtomain);
    add234(handles_by_evtomain, h);

    CreateThread(NULL, 0, handle_input_threadfunc,
		 &h->u.i, 0, &in_threadid);
    h->u.i.busy = TRUE;

    return h;
}

struct handle *handle_output_new(HANDLE handle, handle_outputfn_t sentdata,
				 void *privdata, int flags)
{
    struct handle *h = snew(struct handle);
    DWORD out_threadid; /* required for Win9x */

    h->output = TRUE;
    h->u.o.h = handle;
    h->u.o.ev_to_main = CreateEvent(NULL, FALSE, FALSE, NULL);
    h->u.o.ev_from_main = CreateEvent(NULL, FALSE, FALSE, NULL);
    h->u.o.busy = FALSE;
    h->u.o.defunct = FALSE;
    h->u.o.moribund = FALSE;
    h->u.o.done = FALSE;
    h->u.o.privdata = privdata;
    bufchain_init(&h->u.o.queued_data);
    h->u.o.sentdata = sentdata;
    h->u.o.flags = flags;

    if (!handles_by_evtomain)
	handles_by_evtomain = newtree234(handle_cmp_evtomain);
    add234(handles_by_evtomain, h);

    CreateThread(NULL, 0, handle_output_threadfunc,
		 &h->u.i, 0, &out_threadid);

    return h;
}

int handle_write(struct handle *h, const void *data, int len)
{
    assert(h->output);
    bufchain_add(&h->u.o.queued_data, data, len);
    handle_try_output(&h->u.o);
    return bufchain_size(&h->u.o.queued_data);
}

HANDLE *handle_get_events(int *nevents)
{
    HANDLE *ret;
    struct handle *h;
    int i, n, size;

    /*
     * Go through our tree counting the handle objects currently
     * engaged in useful activity.
     */
    ret = NULL;
    n = size = 0;
    if (handles_by_evtomain) {
	for (i = 0; (h = index234(handles_by_evtomain, i)) != NULL; i++) {
	    if (h->u.g.busy) {
		if (n >= size) {
		    size += 32;
		    ret = sresize(ret, size, HANDLE);
		}
		ret[n++] = h->u.g.ev_to_main;
	    }
	}
    }

    *nevents = n;
    return ret;
}

static void handle_destroy(struct handle *h)
{
    if (h->output)
	bufchain_clear(&h->u.o.queued_data);
    CloseHandle(h->u.g.ev_from_main);
    CloseHandle(h->u.g.ev_to_main);
    del234(handles_by_evtomain, h);
    sfree(h);
}

void handle_free(struct handle *h)
{
    /*
     * If the handle is currently busy, we cannot immediately free
     * it. Instead we must wait until it's finished its current
     * operation, because otherwise the subthread will write to
     * invalid memory after we free its context from under it.
     */
    assert(h && !h->u.g.moribund);
    if (h->u.g.busy) {
	/*
	 * Just set the moribund flag, which will be noticed next
	 * time an operation completes.
	 */
	h->u.g.moribund = TRUE;
    } else if (h->u.g.defunct) {
	/*
	 * There isn't even a subthread; we can go straight to
	 * handle_destroy.
	 */
	handle_destroy(h);
    } else {
	/*
	 * The subthread is alive but not busy, so we now signal it
	 * to die. Set the moribund flag to indicate that it will
	 * want destroying after that.
	 */
	h->u.g.moribund = TRUE;
	h->u.g.done = TRUE;
	h->u.g.busy = TRUE;
	SetEvent(h->u.g.ev_from_main);
    }
}

void handle_got_event(HANDLE event)
{
    struct handle *h;

    assert(handles_by_evtomain);
    h = find234(handles_by_evtomain, &event, handle_find_evtomain);
    if (!h) {
	/*
	 * This isn't an error condition. If two or more event
	 * objects were signalled during the same select operation,
	 * and processing of the first caused the second handle to
	 * be closed, then it will sometimes happen that we receive
	 * an event notification here for a handle which is already
	 * deceased. In that situation we simply do nothing.
	 */
	return;
    }

    if (h->u.g.moribund) {
	/*
	 * A moribund handle is already treated as dead from the
	 * external user's point of view, so do nothing with the
	 * actual event. Just signal the thread to die if
	 * necessary, or destroy the handle if not.
	 */
	if (h->u.g.done) {
	    handle_destroy(h);
	} else {
	    h->u.g.done = TRUE;
	    h->u.g.busy = TRUE;
	    SetEvent(h->u.g.ev_from_main);
	}
	return;
    }

    if (!h->output) {
	int backlog;

	h->u.i.busy = FALSE;

	/*
	 * A signal on an input handle means data has arrived.
	 */
	if (h->u.i.len == 0) {
	    /*
	     * EOF, or (nearly equivalently) read error.
	     */
	    h->u.i.gotdata(h, NULL, -h->u.i.readerr);
	    h->u.i.defunct = TRUE;
	} else {
	    backlog = h->u.i.gotdata(h, h->u.i.buffer, h->u.i.len);
	    handle_throttle(&h->u.i, backlog);
	}
    } else {
	h->u.o.busy = FALSE;

	/*
	 * A signal on an output handle means we have completed a
	 * write. Call the callback to indicate that the output
	 * buffer size has decreased, or to indicate an error.
	 */
	if (h->u.o.writeerr) {
	    /*
	     * Write error. Send a negative value to the callback,
	     * and mark the thread as defunct (because the output
	     * thread is terminating by now).
	     */
	    h->u.o.sentdata(h, -h->u.o.writeerr);
	    h->u.o.defunct = TRUE;
	} else {
	    bufchain_consume(&h->u.o.queued_data, h->u.o.lenwritten);
	    h->u.o.sentdata(h, bufchain_size(&h->u.o.queued_data));
	    handle_try_output(&h->u.o);
	}
    }
}

void handle_unthrottle(struct handle *h, int backlog)
{
    assert(!h->output);
    handle_throttle(&h->u.i, backlog);
}

int handle_backlog(struct handle *h)
{
    assert(h->output);
    return bufchain_size(&h->u.o.queued_data);
}

void *handle_get_privdata(struct handle *h)
{
    return h->u.g.privdata;
}

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
亚洲欧美在线另类| 中文字幕亚洲一区二区va在线| 日韩一区二区在线观看| 国产无人区一区二区三区| 亚洲国产cao| 国产a久久麻豆| 91精品视频网| 亚洲乱码一区二区三区在线观看| 九色porny丨国产精品| 在线欧美小视频| 国产日本欧美一区二区| 蜜桃视频在线一区| 欧美主播一区二区三区美女| 国产精品久久久久久一区二区三区| 日韩成人午夜精品| 欧美在线制服丝袜| 18涩涩午夜精品.www| 国产99久久精品| 久久综合久久综合久久综合| 日本亚洲欧美天堂免费| 91麻豆高清视频| 国产精品白丝在线| 成人免费观看视频| 国产亚洲精品aa| 色综合中文综合网| 亚洲国产成人tv| 成人久久视频在线观看| 最新国产成人在线观看| 免费观看91视频大全| 欧美日韩免费视频| 亚洲综合一区二区三区| 色婷婷久久综合| 亚洲精品国产视频| 99精品国产99久久久久久白柏| 亚洲国产成人午夜在线一区| 国产成人在线网站| 国产欧美视频一区二区三区| 成人免费av网站| 亚洲欧洲三级电影| 91久久一区二区| 亚洲一区电影777| 制服丝袜中文字幕一区| 免费三级欧美电影| 日韩美女视频在线| 视频一区视频二区在线观看| 91精品国产一区二区三区蜜臀 | 国产尤物一区二区| 久久久国产综合精品女国产盗摄| 国产九色sp调教91| 国产日产亚洲精品系列| av一区二区不卡| 亚洲国产一区二区三区| 7777精品伊人久久久大香线蕉的| 日本v片在线高清不卡在线观看| 欧美电影免费观看高清完整版在 | 91久久精品一区二区二区| 一区二区三区日韩精品视频| 欧美精品在线一区二区| 另类调教123区| 亚洲久草在线视频| 中文字幕欧美日韩一区| 成人福利视频网站| 亚洲伊人伊色伊影伊综合网| 91麻豆精品国产91久久久久| 国内精品久久久久影院一蜜桃| 国产精品免费久久| 欧美日韩一区三区| 国产精品自拍在线| 亚洲精品免费在线观看| 欧美一区二区久久| 国产99久久久国产精品| 午夜精品久久久久影视| 国产三级一区二区| 欧美日韩综合不卡| 国产精品66部| 婷婷久久综合九色综合绿巨人| 久久久久久久久99精品| 欧美精品自拍偷拍| av影院午夜一区| 九一九一国产精品| 一个色妞综合视频在线观看| 一区二区三区精品| 91首页免费视频| 轻轻草成人在线| 成人免费一区二区三区在线观看| 欧美肥妇bbw| 色网站国产精品| 国产91精品精华液一区二区三区| 亚洲午夜电影在线| 国产精品久久久久四虎| 精品久久久久久久久久久久久久久 | 国产精品美女一区二区三区| 欧美群妇大交群中文字幕| 99久久精品99国产精品| 久久99精品久久久| 亚洲高清在线视频| 亚洲日本在线天堂| 欧美激情在线观看视频免费| 欧美大片一区二区三区| 欧美福利一区二区| 91福利视频网站| 91丨九色丨蝌蚪富婆spa| 国内外成人在线| 欧美视频在线一区| 国产一区在线看| 久久国产剧场电影| 全部av―极品视觉盛宴亚洲| 亚洲日本青草视频在线怡红院| 日韩一二三四区| 日韩视频免费观看高清完整版在线观看 | 久久综合色天天久久综合图片| 欧美精选在线播放| 欧美久久久久久久久中文字幕| 欧美最新大片在线看| 色天天综合色天天久久| 成人中文字幕在线| 国产v日产∨综合v精品视频| 国产+成+人+亚洲欧洲自线| 国产乱人伦精品一区二区在线观看| 日韩欧美aaaaaa| 一本久久精品一区二区 | 日韩va亚洲va欧美va久久| 亚洲成国产人片在线观看| 亚洲电影第三页| 日韩avvvv在线播放| 免费精品99久久国产综合精品| 日韩电影在线免费看| 三级影片在线观看欧美日韩一区二区 | 秋霞午夜av一区二区三区| 日韩avvvv在线播放| 久久99国产精品久久| 国产成都精品91一区二区三| 91免费版在线看| 欧美性大战久久久久久久蜜臀| 精品视频一区二区不卡| 日韩午夜激情电影| 久久九九影视网| 亚洲女同ⅹxx女同tv| 日韩国产高清在线| 国内精品免费在线观看| 不卡av在线免费观看| 欧美亚洲另类激情小说| 日韩视频在线观看一区二区| 国产日韩欧美一区二区三区综合 | 午夜精品久久久久久久| 久久综合综合久久综合| 国产91富婆露脸刺激对白| 99久久夜色精品国产网站| 欧美日韩综合在线| 久久久一区二区| 亚洲成人黄色影院| 国模套图日韩精品一区二区| 91视频免费看| 日韩免费一区二区| 中文字幕亚洲区| 免费成人结看片| 白白色亚洲国产精品| 91.麻豆视频| 中文字幕电影一区| 日韩国产成人精品| 91免费观看国产| 久久影视一区二区| 性久久久久久久| 国产成人av一区二区三区在线观看| 日本韩国精品在线| 久久久久久久久久看片| 日韩电影在线免费观看| 91一区一区三区| 久久婷婷综合激情| 日韩福利视频导航| 91丝袜美女网| 欧美韩国日本不卡| 免费美女久久99| 欧美无砖专区一中文字| 中文字幕中文乱码欧美一区二区| 看电视剧不卡顿的网站| 欧美日韩久久一区| 亚洲蜜臀av乱码久久精品| 国产一区二区三区不卡在线观看| 欧美日韩成人一区| 亚洲欧美日韩久久精品| 丰满放荡岳乱妇91ww| 欧美一级生活片| 午夜精品福利一区二区三区av| 不卡影院免费观看| 国产日韩v精品一区二区| 精品影视av免费| 日韩欧美色电影| 日本少妇一区二区| 在线成人免费观看| 午夜精品久久久久久久久久| 91蜜桃视频在线| 亚洲天堂福利av| 91丨九色porny丨蝌蚪| 一色桃子久久精品亚洲| 大胆亚洲人体视频| 亚洲国产精品av| 成人黄色综合网站| 亚洲欧洲一区二区三区| 99视频在线精品|