Skip to content
Tcl Source Code Attachment Details
Login

Attachment Details

Overview

Artifact ID: 1bb5fb4d6fbac52c05d812acdebabecd370e6d7b
Ticket: 2946474fffffffffffffffffffffffffffffffff
Date: 2011-08-18 02:59:02
User: andreas_kupries
Artifact Attached: 2ba62edfce865da3e474dfcc41a1442cf575492d
Filename:asyncflush-new-test.txt
Description:Additional test showing how there is a write from a bg-flush-on-close.
Content:

test iocmd.tf-24.16 {chan write, note the background flush setup by close due to the EAGAIN leaving data in buffers.} -match glob -setup {
    set res {}
    proc foo {args} {
	oninit; onfinal; track
	# Note: The EAGAIN signals that the channel cannot accept
	# write requests right now, this in turn causes the IO core to
	# request the generation of writable events (see expected
	# result below, and compare to case 24.14 above).
	error EAGAIN
    }
    set c [chan create {r w} foo]
} -body {
    notes [inthread $c {
	note [puts -nonewline $c ABC ; flush $c]
	close $c
	notes
    } c]
    # Replace handler with all-tracking one which doesn't error.
    # This will tell us if a write-due-flush is there.
    proc foo {args} { note BG ; track }
    # Flush (sic!) the event-queue to capture the write from a
    # BG-flush.
    update
    set res
} -cleanup {
    rename foo {}
    unset res
} -result {{write rc* ABC} {watch rc* write} {} BG {write rc* ABC}} \
    -constraints {testchannel testthread}