Eskil

Check-in [e650f1067c]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Added ability to transfer mounts to another thread.
Downloads: Tarball | ZIP archive
Timelines: family | ancestors | descendants | both | thread
Files: files | file ages | folders
SHA1: e650f1067c4c3b9b8450d558d2e0d93e8ff0559a
User & Date: peter 2016-08-03 17:44:25.654
Context
2016-08-03
17:45
Merge from trunk check-in: d1d44e3aed user: peter tags: thread
17:44
Added ability to transfer mounts to another thread. check-in: e650f1067c user: peter tags: thread
2016-07-05
22:37
Experiment with worker thread. check-in: f6e6a1dde6 user: peter tags: thread
Changes
Unified Diff Ignore Whitespace Patch
Changes to src/vcsvfs.tcl.
747
748
749
750
751
752
753
























754
755
756
757
758
759
760
        createdirectory - deletefile - removedirectory - utime {
            # Read-only, always error
        }
    }
    vfs::filesystem posixerror $::vfs::posix(EACCES)
    return -code error $::vfs::posix(EACCES)
}

























##################################################################
# Test structure
##################################################################
if 0 {
# File traversing stuff from wiki...
proc ftw_1 {{dirs .}} {







>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>







747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
        createdirectory - deletefile - removedirectory - utime {
            # Read-only, always error
        }
    }
    vfs::filesystem posixerror $::vfs::posix(EACCES)
    return -code error $::vfs::posix(EACCES)
}

# Transfer a VcsVfs mount point to another Thread.
# TclVfs mounts are thread local.
# If no mount point is given, tranfer all current mount points
proc vcsvfs::transfer {threadId {mountpoint {}}} {
    variable mpoints
    thread::send -async $threadId "package require vcsvfs"
    if {$mountpoint eq ""} {
        set data $mpoints
    } else {
        set data [dict create $mountpoint [dict get $mpoints $mountpoint]]
    }
    # Data might be large. Is that a problem? Is there a more efficient way?
    thread::send -async $threadId [list vcsvfs::Receive $data]
}

# Create mount(s) from received data
proc vcsvfs::Receive {data} {
    variable mpoints
    foreach mountpoint [dict keys $data] {
        dict set mpoints $mountpoint [dict get $data $mountpoint]
        vfs::filesystem mount $mountpoint [list vcsvfs::Vfs]
    }
}

##################################################################
# Test structure
##################################################################
if 0 {
# File traversing stuff from wiki...
proc ftw_1 {{dirs .}} {