Skip to content
Tcl Source Code View Ticket
Login

View Ticket

2005-01-28
05:54 • Closed ticket [875701ffff]: TIP#218 (Tcl Channel Driver Thread State Actions)</i... artifact: 8969722a2a user: andreas_kupries
05:51 • Add attachment tcl8.4_all_002.diff to ticket [875701ffffffffff|875701ff... artifact: cee411575d user: andreas_kupries
05:51 • Ticket [875701ffff] TIP#218 (Tcl Channel Driver Thread State Actions) status... artifact: 03d95427f4 user: andreas_kupries
2005-01-27
06:44 • Ticket [875701ffff]: 4 changes artifact: a9bd0c33ac user: andreas_kupries
06:43 • Ticket [875701ffff]: 4 changes artifact: 84edf3f4f1 user: andreas_kupries
06:43 • Add attachment tcl8.5_all_003.diff to ticket [875701ffffffffff|875701ff... artifact: 4208f5c7f8 user: andreas_kupries
05:33 • Ticket [875701ffff] TIP#218 (Tcl Channel Driver Thread State Actions) status... artifact: 86efbea7f5 user: andreas_kupries
05:33 • Ticket [875701ffff]: 4 changes artifact: 7596d40317 user: andreas_kupries
05:33 • Ticket [875701ffff]: 1 change artifact: bdd4c90f3b user: andreas_kupries
2004-11-24
08:40 • Ticket [875701ffff]: 4 changes artifact: 7a8160d3ed user: davygrvy
07:05 • Ticket [875701ffff]: 4 changes artifact: 2c387f908b user: andreas_kupries
05:51 • Ticket [875701ffff]: 4 changes artifact: 761ec7fc9f user: davygrvy
2004-10-27
02:48 • Ticket [875701ffff]: 4 changes artifact: 4574568eca user: andreas_kupries
2004-10-22
03:54 • Ticket [875701ffff]: 5 changes artifact: 922825f5e0 user: andreas_kupries
03:50 • Ticket [875701ffff]: 4 changes artifact: a0e0eee617 user: andreas_kupries
03:50 • Add attachment refimpl_218.tar.gz to ticket [875701ffffffffff|875701fff... artifact: aaa58bd5fa user: andreas_kupries
2004-10-21
04:26 • Ticket [875701ffff] TIP#218 (Tcl Channel Driver Thread State Actions) status... artifact: 8968a160b1 user: andreas_kupries
2004-10-15
04:23 • Ticket [875701ffff]: 4 changes artifact: 7186118b6a user: andreas_kupries
04:00 • Ticket [875701ffff]: 4 changes artifact: 1ebe870d66 user: andreas_kupries
04:00 • Add attachment driverconv_v1.tar.gz to ticket [875701ffffffffff|875701f... artifact: a5b0b735c1 user: andreas_kupries
2004-10-09
03:45 • Ticket [875701ffff] TIP#218 (Tcl Channel Driver Thread State Actions) status... artifact: 253db35abd user: andreas_kupries
03:36 • Ticket [875701ffff]: 4 changes artifact: b173de6713 user: davygrvy
03:15 • Ticket [875701ffff]: 4 changes artifact: a8533a9753 user: davygrvy
03:07 • Add attachment threadaction-v2.tar.gz to ticket [875701ffffffffff|87570... artifact: 3102a5b548 user: andreas_kupries
03:07 • Ticket [875701ffff] TIP#218 (Tcl Channel Driver Thread State Actions) status... artifact: ebffd02e7e user: andreas_kupries
03:07 • Ticket [875701ffff]: 4 changes artifact: 38d89e17c8 user: andreas_kupries
2004-09-11
03:07 • Ticket [875701ffff]: 4 changes artifact: 28b311b031 user: andreas_kupries
03:05 • Ticket [875701ffff]: 4 changes artifact: 9c46e72fbe user: andreas_kupries
2004-09-10
15:47 • Ticket [875701ffff]: 2 changes artifact: 36759ed2ca user: dkf
05:58 • Ticket [875701ffff]: 5 changes artifact: f4708a6061 user: andreas_kupries
05:55 • Add attachment threadaction.tar.gz to ticket [875701ffffffffff|875701ff... artifact: c04b4b96e5 user: andreas_kupries
05:55 • Ticket [875701ffff] ver 4 update for Tcl_ChannelType to support cut/splice s... artifact: 028e2656c0 user: andreas_kupries
03:37 • Ticket [875701ffff]: 4 changes artifact: 47b1358b82 user: andreas_kupries
2004-01-23
11:40 • Ticket [875701ffff]: 4 changes artifact: e9c015f7b4 user: davygrvy
2004-01-17
03:03 • Ticket [875701ffff]: 4 changes artifact: 4085117f7e user: davygrvy
03:00 • Ticket [875701ffff]: 4 changes artifact: 47c841eff5 user: davygrvy
2004-01-14
10:14 • Ticket [875701ffff]: 4 changes artifact: 66c46fa9e5 user: davygrvy
10:13 • Ticket [875701ffff]: 4 changes artifact: 5773851d0c user: davygrvy
10:13 • Add attachment patch.txt to ticket [875701ffff] artifact: 1178c9649f user: davygrvy
04:58 • Ticket [875701ffff] ver 4 update for Tcl_ChannelType to support cut/splice s... artifact: 5c6f01c628 user: davygrvy
04:58 • Ticket [875701ffff]: 4 changes artifact: 2db17a593e user: davygrvy
2004-01-13
17:16 • Open ticket [875701ffff]. artifact: 1358b3facf user: dkf
16:58 • Pending ticket [875701ffff]. artifact: 093ddde74b user: davygrvy
07:48 • Ticket [875701ffff]: 4 changes artifact: 5d9866f23a user: davygrvy
07:47 • Ticket [875701ffff]: 4 changes artifact: 3402924c33 user: davygrvy
07:46 • Ticket [875701ffff]: 4 changes artifact: a0b96cb5c4 user: davygrvy
07:45 • Ticket [875701ffff]: 4 changes artifact: fc2e047002 user: davygrvy
07:45 • Ticket [875701ffff]: 4 changes artifact: 7d0c530526 user: davygrvy
04:56 • Ticket [875701ffff]: 4 changes artifact: 41628016b0 user: davygrvy
2004-01-12
21:56 • New ticket [875701ffff]. artifact: 1e4b30acb0 user: davygrvy

TIP#218 (Tcl Channel Driver Thread State Actions)

Closed / Accepted875701ffffffffffffffffffffffffffffffffffCreated 23 years agoUpdated 22 years ago
Descriptionplain2004-01-12 21:56:00
Initial patch..  work in progress, aiming for inclusion in 
8.5.0
davygrvyplain2004-01-13 04:56:01
File Added - 73183: patch.txt
davygrvyplain2004-01-13 07:45:23
Logged In: YES 
user_id=7549

Only tested on Win2K.

All tests pass for rev#2 !!!
davygrvyplain2004-01-13 07:45:24
File Added - 73204: patch.txt
davygrvyplain2004-01-13 07:46:02
File Deleted - 73183:
davygrvyplain2004-01-13 07:47:07
Logged In: YES 
user_id=7549

Untested on unix and mac, but those area where touched by 
the patch and needs testers.
davygrvyplain2004-01-13 07:48:24
Logged In: YES 
user_id=7549

Note to self: add Tcl_DriverCutProc and Tcl_DriverSpliceProc 
to the Tcl_Channel man page.
davygrvyplain2004-01-13 16:58:39
Logged In: YES 
user_id=7549

Andreas,

Could you have a look at this?  Am I on-track?  It looks 
complete to me ('cept for docs).  How does it look to you?
dkfplain2004-01-13 17:16:46
Logged In: YES 
user_id=79902

David, please don't set Status to Pending since it means
that it is Pending Deletion if further information is not
supplied.  Which is not what you meant at all!
davygrvyplain2004-01-14 04:58:56
Logged In: YES 
user_id=7549

rev #3 patch ready.
davygrvyplain2004-01-14 04:58:57
File Deleted - 73204: 



File Added - 73335: patch.txt
davygrvyplain2004-01-14 10:13:19
File Added - 73366: patch.txt

Logged In: YES 
user_id=7549

Final patch ready that includes doc changes.

Things to note:

1) transformChannelType of generic/tclIOGT.c had the version 
set to 2, not 3.  It is setting a wideSeekProc.  Is 3 or 2 the 
correct version?

2) *ALL* channel drivers that maintain any tsd data are all 
now at version 4.  This includes every win channel type, 
now.  Not just restricted to file and socket.

3) HaveVersion() should be fine, re. email note.

4) All internal channel types are at or greater than v2.  Even 
the mac/ ones that no longer are maintained by anyone.

5) Do a 'make genstubs' after applying patch.

6) all tests pass for a threaded build of Tcl.  Does testthread 
do a transfer test and are there test cases?  I haven't looked 
yet.
davygrvyplain2004-01-14 10:14:22
File Deleted - 73335:
davygrvyplain2004-01-17 03:00:52
Logged In: YES 
user_id=7549

Just discovered something interesting.

If I create a v4 driver in an extension and load it into 8.4, 
Tcl_ChannelVersion incorrectly returns 
TCL_CHANNEL_VERSION_1 rather than 
TCL_CHANNEL_VERSION_3

The proper logic, I think would be to add a ceiling expecting 
more revisions in the future.  Example:

Tcl_ChannelTypeVersion
Tcl_ChannelVersion(chanTypePtr)
    Tcl_ChannelType *chanTypePtr;/* Pointer to channel 
type. */
{
    if (chanTypePtr->version == TCL_CHANNEL_VERSION_2) {
return TCL_CHANNEL_VERSION_2;
    } else if (chanTypePtr->version == 
TCL_CHANNEL_VERSION_3) {
return TCL_CHANNEL_VERSION_3;
    } else if (chanTypePtr->version == 
TCL_CHANNEL_VERSION_4) {
return TCL_CHANNEL_VERSION_4;
    /* reserve this space for future revisions. */
    } else if (chanTypePtr->version < 15) {
return TCL_CHANNEL_VERSION_4;
    } else {
/*
 * In <v2 channel versions, the version field is 
occupied
 * by the Tcl_DriverBlockModeProc
 */
return TCL_CHANNEL_VERSION_1;
    }
}
davygrvyplain2004-01-17 03:03:41
Logged In: YES 
user_id=7549

Your note about checking HaveVersion was right.

It will work in the forward direction, a v3 loaded into a core 
that understands up to v4, but not the other way.
davygrvyplain2004-01-23 11:40:32
Logged In: YES 
user_id=7549

This patch is not safe to use in its current form.  I've found a 
bug i'm re-evaluating, a watchmask issue I need to solve.
andreas_kupriesplain2004-09-10 03:37:44
Logged In: YES 
user_id=75003

> 1) transformChannelType of generic/tclIOGT.c
> had the version  set to 2, not 3.  It is setting
> a wideSeekProc.  Is 3 or 2 the correct version?

3 is the correct version.
andreas_kupriesplain2004-09-10 05:55:44
File Added - 100954: threadaction.tar.gz

Logged In: YES 
user_id=75003

The patch had three components.
(a) Bugs & Nits
(b) v4 channel driver code.
(c) Conversion of core drivers to v4.

(a) can go into the core without TIP.
(b) requires a TIP
(c) is based on (b).

Now enclosing a tarball for 8.4 and 8.5 implementing (b).
The only thing missing are testcases for the new
functionality. It does compile, and it does pass the
unextended testsuite.

I am ignoring (c) for now, until we get the TIP approved.
andreas_kupriesplain2004-09-10 05:58:07
File Added - 100955: channel_transfer.tip

Logged In: YES 
user_id=75003

Attaching the TIP draft as well.
dkf Ticket [875701ffff]: 2 changes [History diff]2004-09-10 15:47:12
andreas_kupriesplain2004-09-11 03:05:45
File Deleted - 100955: 

Logged In: YES 
user_id=75003

The TIP is in the official repository, with official
formatting and such. Removing the draft.

The (a) class patches (bugfixes not requiring a TIP) are now
committed to HEAD (8.5 dev) and 8.4 branch head.
andreas_kupriesplain2004-09-11 03:07:19
Logged In: YES 
user_id=75003

The TIP can be found at http://tip.tcl.tk/218
andreas_kupriesplain2004-10-09 03:07:33
Logged In: YES 
user_id=75003

Adding an updated ref. ipmlementation of the basics. The use
of the thread actions when opening a channel means that
existing code to add the instance data to a thread-global
list is obsolete now, actually bogus, i.e. we get a damaged
list. The updated diffs make the minimal changes necessary
for the core to be ok again. This is not the convrsion of
the existing drivers.

This is enough for external channel drivers to use the API.
andreas_kupriesplain2004-10-09 03:07:34
File Added - 104396: threadaction-v2.tar.gz
davygrvyplain2004-10-09 03:15:10
Logged In: YES 
user_id=7549

I'll modify my extensions to experiment on this.
davygrvyplain2004-10-09 03:36:36
Logged In: YES 
user_id=7549

Interesting..  I see TclpSpliceFileChannel(chan); and
TclpSpliceSockChannel(chan); still there..

If this patch is step#2, we'll save removing those for
step#3 when we convert all the channel types to v4, yes?
andreas_kupriesplain2004-10-09 03:45:59
Logged In: YES 
user_id=75003

Yes, the removal of the Tclp{Cut,Splice}... from the old
hackish fix will happen as part of the conversion of all
internal drivers to v4. 

For this patch I just wanted to get the API completely
implemented, and the core running flawlessly, without
touching the core drivers and their hardwired threadactions.
I had to touch the hardwired socket splice, or cut, because
of a bug regarding "socketList" and "socketListLock".
Wherever I did that I added commentary about the removed
code, as explanation.
andreas_kupriesplain2004-10-15 04:00:04
File Added - 105145: driverconv_v1.tar.gz

Logged In: YES 
user_id=75003

And here is the first patch for the conversions of all
in-core channel drivers to v4. Even if it was just something
like changing the version number and adding NULLs to the
structure.

The patches passed compilation and testsuite of Tcl, on
linux and windows, for regular and threaded build.

_Not_ tested yet is that these changes actually work when a
channel for their is truly transfered. Because (I believe)
this is not tested by the in-core testsuite. The thread
extension might test this. Investigation will start on that.

Still, others are welcome to play with this now.
andreas_kupriesplain2004-10-15 04:23:46
Logged In: YES 
user_id=75003

Seems that the thread extension does some basic tests of
'transfer', but only for files, in essence. It seems that I
will have to extend this to cover all in-core drivers in
some way or other.

Uh, tests which are interdependent (18.1, .2, .3 for example).

Nevertheless. This can be used for a basic first test.
andreas_kupriesplain2004-10-21 04:26:24
Logged In: YES 
user_id=75003

I added some more tests. I have now run tests against 8.5
head, and 8.4 head, pristine, with base patch, and
base+driver patch (= 6 configs).

I am unable to crash 8.5 with my tests, patches or not. 8.4
crashes the extended tests without patches, or only the base
patch applied. It is ok if both base and driver patch are
applied.

This is for sockets.

For pipes I was unable to crash my tests anywhere. It should
however be possible to either crash transfered pipe
channels, or to stop them from working (no events, due
misdirected thread-alerts).

I have found a limitation regarding transfered pipe channels
and linux: Closing a transfered pipe channel in a different
thread than it was created by causes an error, child lost.
That seems to be a limitation in linux thread impl., and its
interaction with waitpid. It is not a crash, just an error
message about a lost child which is bogus. cleanup and all
that seems to be ok however.
andreas_kupriesplain2004-10-22 03:50:43
File Added - 105992: refimpl_218.tar.gz
andreas_kupriesplain2004-10-22 03:54:56
Logged In: YES 
user_id=75003

I have merged the base patch and driver conversion together,
and updated them both to apply to the current 8.[45] CVS
head. This patch has been called the "Full Ref.
Implementation V1".

I was able to create tests for fileevents for pipes which
fail under windows for an unpatched core, and are ok for the
patched core. These tests are 17.11[ab] in the package
Thread, and were committed today as well.

I consider this patch good enough for wider testing. I
believe that this patch is ok.
andreas_kupriesplain2004-10-27 02:48:28
Logged In: YES 
user_id=75003

See also the bug report
http://sourceforge.net/tracker/index.php?func=detail&aid=1021078&group_id=10894&atid=110894
davygrvyplain2004-11-24 05:51:55
Logged In: YES 
user_id=7549

Andreas,
trying patch today with my iocpsock extension.  I'll post
progress notes here later.
andreas_kupriesplain2004-11-24 07:05:35
Logged In: YES 
user_id=75003

Very good, thanks.
davygrvyplain2004-11-24 08:40:01
Logged In: YES 
user_id=7549

looks good so far
will be testing over the next few days
andreas_kupries Ticket [875701ffff]: 1 change [History diff]2005-01-27 05:33:25
andreas_kupriesplain2005-01-27 05:33:26
Logged In: YES 
user_id=75003

The TIP has been accepted (6 yes, 0 no, 0 present).
Updated the 8.5 patch with correct numbers for the new stub
slots.
andreas_kupriesplain2005-01-27 05:33:29
File Added - 117284: tcl8.5_all_002.diff
andreas_kupriesplain2005-01-27 06:43:33
File Deleted - 117284: 



File Added - 117297: tcl8.5_all_003.diff
andreas_kupriesplain2005-01-27 06:44:35
Logged In: YES 
user_id=75003

Reupload, found one small problem on windows, a new change
by Mo used the old Cut function and I was not aware of it
yet. Found it when the link failed.
andreas_kupriesplain2005-01-28 05:51:23
File Added - 117453: tcl8.4_all_002.diff

Logged In: YES 
user_id=75003

Upload of 8.4 final patch.
andreas_kupriesplain2005-01-28 05:54:15
Logged In: YES 
user_id=75003

Both final patches have been committed to 8.4 branch head
and 8.5 head respectively.
Log in (anonymous is fine) to add a comment.

Attachments: