Repository navigation
Modern Chan Channel SendFor
Paul Squires edited this page Oct 19, 2026
·
5 revisions
Home › Goroutines and Channels › Goroutines and Channels › SendFor
Sends a value, waiting at most ms milliseconds; returns false on a timeout.
SendFor( byref v as T, byval ms as uint32 ) as boolean- FALSE means the timeout expired. Like
SendandTrySend, it raises on a closed channel rather than reporting one. - The bounded middle ground between
Send, which waits forever, andTrySend, which does not wait at all. - Every blocking operation in this design takes a timeout, so a cancellable goroutine can be written to wake and check its Context.
#import "std/tasks"
using tasks
dim ch as Channel( of int32 ) = Channel( of int32 )( 1 )
dim as int32 a = 1
print ch.SendFor( a, 100 ) '' true -- room in the buffer
dim as int32 b = 2
print ch.SendFor( b, 50 ) '' false -- full, and it waited 50 ms
'' This is how a cancellable producer is written: wake regularly and
'' check whether the Context has been cancelledLibrary: Goroutines and Channels
Category: Goroutines and Channels
Documented under: Members
tiko-lang · Home · Feature Index · Keyword Index · License
FreeBASIC manual pages reproduced under the GNU FDL 1.3.
- Generics
- Interfaces
- For Each
- Iterators
- Tuples
- Array Results
- Defer
- Lambdas
- Block Strings
- Partial Types
- String Slices
- Embed
- Typed Variadics
- C Header Import
- Foreign Library Linking
- UString
- Fixed-Width Types
- Nullptr
- String Library
- Format
- Array
- Map
- Set
- LinkedList
- OrderedMap
- OrderedSet
- Sorting
- Optional
- Result
- Smart Pointers
- Date and Time (Chrono)
- Filesystem
- File Streams
- Config (INI and TOML)
- Codec
- Hash
- UUID
- OS
- Process
- Net
- HTTP and TLS
- Math Library
- Finance
- Logging
- Terminal TUI Library
- PsControls
- tkControls
- sys/win
- Goroutines and Channels
- LLVM Backend
- tiko build
- TIKO_COMPILER
- Variable Declarations
- Standard Data Types
- User Defined Types
- Procedures
- Operators
- Control Flow Statements
- Converting Data Types
- Array Functions
- String Functions
- Mathematical Functions
- Bit Manipulation
- Date and Time Functions
- File I/O Functions
- Console Functions
- User Input (Runtime Library)
- User Input Functions (Graphics Library)
- Screen Functions
- 2D Drawing Functions
- Graphics Library Reference
- Graphics Keyword List
- Memory Functions
- Threading Support Functions
- Error Handling Functions
- Operating System Functions
- Preprocessor
- Intrinsic Defines
- Miscellaneous Keywords
- Modularizing