0% found this document useful (0 votes)
11 views

CLR Via C Applied Microsoft Net Framework 2 0 Programming 2nd ed. Edition Jeffrey Richter download

The document provides information about various programming books, including 'CLR Via C#' by Jeffrey Richter, and other titles related to Microsoft technologies. It highlights the availability of instant digital downloads and includes a detailed table of contents for 'CLR Via C#' covering various aspects of the .NET Framework and the Common Language Runtime. Additionally, it features endorsements from notable figures at Microsoft praising the book's clarity and depth in explaining complex topics.

Uploaded by

wensfet
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
11 views

CLR Via C Applied Microsoft Net Framework 2 0 Programming 2nd ed. Edition Jeffrey Richter download

The document provides information about various programming books, including 'CLR Via C#' by Jeffrey Richter, and other titles related to Microsoft technologies. It highlights the availability of instant digital downloads and includes a detailed table of contents for 'CLR Via C#' covering various aspects of the .NET Framework and the Common Language Runtime. Additionally, it features endorsements from notable figures at Microsoft praising the book's clarity and depth in explaining complex topics.

Uploaded by

wensfet
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 63

CLR Via C Applied Microsoft Net Framework 2 0

Programming 2nd ed. Edition Jeffrey Richter pdf


download

https://ebookname.com/product/clr-via-c-applied-microsoft-net-
framework-2-0-programming-2nd-ed-edition-jeffrey-richter/

Get Instant Ebook Downloads – Browse at https://ebookname.com


Instant digital products (PDF, ePub, MOBI) available
Download now and explore formats that suit you...

Microsoft Windows PowerShell 2 0 programming for the


absolute beginner 2nd ed Edition Jerry Lee Ford

https://ebookname.com/product/microsoft-windows-
powershell-2-0-programming-for-the-absolute-beginner-2nd-ed-
edition-jerry-lee-ford/

Programming in Objective C 2 0 2nd Edition Stephen G.


Kochan

https://ebookname.com/product/programming-in-objective-c-2-0-2nd-
edition-stephen-g-kochan/

Pro Dynamic NET 4 0 Applications Data Driven


Programming for the NET Framework 1st Edition Carl Ganz
Jr.

https://ebookname.com/product/pro-dynamic-net-4-0-applications-
data-driven-programming-for-the-net-framework-1st-edition-carl-
ganz-jr/

God Is Watching You How the Fear of God Makes Us Human


1st Edition Dominic Johnson

https://ebookname.com/product/god-is-watching-you-how-the-fear-
of-god-makes-us-human-1st-edition-dominic-johnson/
American Textbook Reading Social studies4 2013th
Edition Ellen Guerrero

https://ebookname.com/product/american-textbook-reading-social-
studies4-2013th-edition-ellen-guerrero/

Clinical Guide to Obsessive Compulsive and Related


Disorders 1st Edition Jon E. Grant

https://ebookname.com/product/clinical-guide-to-obsessive-
compulsive-and-related-disorders-1st-edition-jon-e-grant/

Browse s Introduction to the Symptoms Signs of Surgical


Disease 4th Edition Norman L. Browse

https://ebookname.com/product/browse-s-introduction-to-the-
symptoms-signs-of-surgical-disease-4th-edition-norman-l-browse/

A Contribution to the Critique of Contemporary


Capitalism Theoretical and International Perspectives
Global Political Studies Das

https://ebookname.com/product/a-contribution-to-the-critique-of-
contemporary-capitalism-theoretical-and-international-
perspectives-global-political-studies-das/

Adorno in America 1st Edition David Jenemann

https://ebookname.com/product/adorno-in-america-1st-edition-
david-jenemann/
The Integrated Nervous System A Systematic Diagnostic
Approach 1 Har/Cdr Edition Walter Hendelman M.D.

https://ebookname.com/product/the-integrated-nervous-system-a-
systematic-diagnostic-approach-1-har-cdr-edition-walter-
hendelman-m-d/
Additional Resources for Developers
Published and Forthcoming Titles on Microsoft Visual Studio 2005 and SQL Server 2005

Visual Basic 2005 Programming Microsoft Programming Microsoft Working with Microsoft
ASP.NET 2.0 SQL Server 2005 Visual Studio® 2005
Microsoft® Visual Basic® 2005 Core Reference Team System
Andrew J. Brust, Stephen
Express Edition: Richard Hundhausen
Dino Esposito Forte, and William H. Zack
Build a Program Now! 0-7356-2185-3
0-7356-2176-4 0-7356-1923-9
Patrice Pelland
0-7356-2213-2
Programming Microsoft Inside Microsoft Other
Microsoft Visual Basic 2005
ASP.NET 2.0 Applications SQL Server 2005: Developer Topics
Advanced Topics The Storage Engine
Step by Step Software Estimation:
Dino Esposito Kalen Delaney
Michael Halvorson 0-7356-2177-2 Demystifying the Black Art
0-7356-2105-5
0-7356-2131-4 Steve McConnell
0-7356-0535-1
Programming Microsoft Database Inside Microsoft
SQL Server 2005:
Visual Basic 2005: Microsoft ADO.NET 2.0 The Security
T-SQL Programming
The Language Step by Step Development Lifecycle
Itzik Ben-Gan, et al.
Francesco Balena Rebecca M. Riordan Michael Howard
0-7356-2197-7
0-7356-2183-7 0-7356-2164-0 Steve Lipner
Inside Microsoft 0-7356-2214-0
C# 2005 Programming Microsoft
SQL Server 2005:
ADO.NET 2.0 Writing Secure Code,
Microsoft Visual C#® 2005 Core Reference
Query Tuning and
Optimization Second Edition
Express Edition:
David Sceppa Michael Howard
Build a Program Now! Kalen Delaney
0-7356-2206-X David LeBlanc
Patrice Pelland 0-7356-2196-9
0-7356-1722-8
0-7356-2229-9
Programming Microsoft
Inside Microsoft
ADO.NET 2.0 Code Complete,
Microsoft Visual C# 2005 SQL Server 2005:
Advanced Topics Second Edition
Step by Step T-SQL Querying
Glenn Johnson Steve McConnell
John Sharp Itzik Ben-Gan, et al.
0-7356-2141-1 0-7356-1967-0
0-7356-2129-2 0-7356-2313-9

Programming Microsoft SQL Server 2005 Other Visual


Programming Connected
Systems with Microsoft
Visual C# 2005: Microsoft SQL Server® 2005 Studio 2005 Topics WinFX®: A Programmer's
The Language Express Edition Step by Step:
Programming Microsoft Guide
Donis Marshall Developing Database
Applications Windows® Forms Aaron Skonnard
0-7356-2181-0
Charles Petzold Matt Milner
Jackie Goldstein
0-7356-2153-5 0-7356-2258-2
CLR via C#, 0-7356-2184-5
Second Edition
Programming Microsoft Software Requirements,
Jeffrey Richter Microsoft SQL Server 2005
Web Forms Second Edition
0-7356-2163-2 Programming
Douglas J. Reilly Karl E. Wiegers
Step by Step
0-7356-2179-9 0-7356-1879-8
Web Development Fernando Guerrero
0-7356-2207-8
Microsoft Visual Web Debugging, Tuning, and More About Software
Developer ® 2005 Testing Microsoft .NET 2.0 Requirements: Thorny
Microsoft SQL Server 2005
Express Edition: Applications Issues and Practical Advice
Analysis Services
Build a Web Site Now! John Robbins Karl E. Wiegers
Step by Step
Jim Buyens 0-7356-2202-7 0-7356-2267-1
Hitachi Consulting
0-7356-2212-4
0-7356-2199-3
CLR via C+ +
Microsoft ASP.NET 2.0 Jeffrey Richter with
Microsoft SQL Server 2005
Step by Step Stanley B. Lippman
Reporting Services
George Shepherd 0-7356-2248-5
Step by Step
0-7356-2201-9
Hitachi Consulting
0-7356-2250-7

Explore our full line of learning resources at: microsoft.com/mspress and microsoft.com/learning
Acclaim for the First Edition: Applied
Microsoft .NET Framework Programming
The time Jeffrey spent with the .NET Framework is evident in this well-written and
informative book.
— Eric Rudder (senior vice president, developer and platform evangelism, Microsoft)

Jeff has worked directly with the folks who built the CLR [common language runtime]
on a daily basis and has written the finest book on the internals of the CLR that you'll
find anywhere.
— Dennis Angeline (lead program manager, common language runtime, Microsoft)

Jeff brings his years of Windows programming experience and insight to explain how
the .NET Framework really works, why we built it the way we did, and how you can
get the most out of it.
— Brad Abrams (lead program manager, .NET Framework, Microsoft)

Jeff Richter brings his well-known flair for explaining complicated material clearly,
concisely and accurately to the new areas of the C# language, the .NET Framework,
and the .NET common language runtime. This is a must-have book for anyone want-
ing to understand the whys and hows behind these important new technologies.
— Jim Miller (lead program manager, common language runtime kernel, Microsoft)

Easily the best book on the common language runtime. The chapter on the CLR gar-
bage collector [Chapter 19 in the first edition, now Chapter 20] is awesome. Jeff not
only describes the theory of how the garbage collector works but also discusses aspects
of finalization that every .NET developer should know.
— Mahesh Prakriya (lead program manager, common language runtime team, Microsoft)

This book is an accurate, in-depth, yet readable exploration of the common language
runtime. It's one of those rare books that seems to anticipate the reader's question and
supply the answer in the very next paragraph. The writing is excellent.
— Jim Hogg (program manager, common language runtime team, Microsoft)
Just as Programming Applications for Microsoft Windows became the must-have book for
Win32 programmers, Applied Microsoft .NET Programming promises to be the same for
serious .NET Framework programmers. This book is unique in its bottom-up approach
to understanding .NET Framework programming. By providing the reader with a solid
understanding of lower-level CLR concepts, Jeff provides the groundwork needed to
write solid, secure, high-performing managed code applications quickly and easily.
— Steven Pratschner (program manager, common language runtime team, Microsoft)

Jeff Richter, he the MAN!


— Anonymous (program manager, common language runtime, Microsoft)
Microsoft®

CLR via C#, Second Edition

Jeffrey Richter (Wintellect)


Foreword by Aidan Richter
PUBLISHED BY
Microsoft Press
A Division of Microsoft Corporation
One Microsoft Way
Redmond, Washington 98052-6399
Copyright © 2006 by Jeffrey Richter
All rights reserved. No part of the contents of this book may be reproduced or transmitted in any form or by
any means without the written permission of the publisher.

Library of Congress Control Number 2005936868

Printed and bound in the United States of America.

123456789 QWT 8 7 6

Distributed in Canada by H.B. Fenn and Company Ltd.


A CIP catalogue record for this book is available from the British Library.
Microsoft Press books are available through booksellers and distributors worldwide. For further information
about international editions, contact your local Microsoft Corporation office or contact Microsoft Press Inter-
national directly at fax (425) 936-7329. Visit our Web site at www.microsoft.com/mspress. Send comments
to [email protected].
Microsoft, Active Accessibility, Active Directory, ActiveX, Authenticode, DirectX, Excel, IntelliSense,
JScript, Microsoft Press, MSDN, MSN, OpenType, Visual Basic, Visual Studio, Win32, Windows, Windows
CE, Windows NT, Windows Server, and WinFX are either registered trademarks or trademarks of Microsoft
Corporation in the United States and/or other countries. Other product and company names mentioned herein
may be the trademarks of their respective owners.
The example companies, organizations, products, domain names, e-mail addresses, logos, people, places, and
events depicted herein are fictitious. No association with any real company, organization, product, domain
name, e-mail address, logo, person, place, or event is intended or should be inferred.
This book expresses the author's views and opinions. The information contained in this book is provided with-
out any express, statutory, or implied warranties. Neither the authors, Microsoft Corporation, nor its resellers,
or distributors will be held liable for any damages caused or alleged to be caused either directly or indirectly
by this book.
Acquisitions Editor: Ben Ryan
Project Editor: Devon Musgrave
Indexer: William S. Myers
Body Part No. XI1-53580
To Kristin
Words cannot express how I feel about our life together. I cherish our family and
all our adventures. I'm filled each day with love for you.

To Aidan
You have been an inspiration to me and have taught me to play and have fun.
Watching you grow up has been so rewarding and enjoyable for me. I feel lucky to be
able to partake in your life; it has made me a better person.
Contents at a Glance
Part I CLR Basics
1 The CLR's Execution Model 3
2 Building, Packaging, Deploying, and Administering
Applications and Types 33
3 Shared Assemblies and Strongly Named Assemblies 65

Part II Working with Types


4 Type Fundamentals 97
5 Primitive, Reference, and Value Types 117

Part III Designing Types


6 Type and Member Basics 153
7 Constants and Fields 177
8 Methods: Constructors, Operators, Conversions, and Parameters... 183
9 Properties 213
10 Events 225

Part IV Essential Types


11 Chars, Strings, and Text 241
12 Enumerated Types and Bit Flags 285
13 Arrays 295
14 Interfaces 311
15 Delegates 331
16 Generics 359
17 Custom Attributes 387
18 Nullable Value Types 409

Part V CLR Facilities


19 Exceptions 419
20 Automatic Memory Management (Garbage Collection) 457

vii
viii Contents at a Glance

21 CLR Hosting and AppDomains 521


22 Assembly Loading and Reflection 549
23 Performing Asynchronous Operations 585
24 Thread Synchronization 621
Contents
Foreword xix
Introduction xxi

Part I CLR Basics


1 The CLR's Execution Model 3
Compiling Source Code into Managed Modules 3
Combining Managed Modules into Assemblies 6
Loading the Common Language Runtime 8
Executing Your Assembly's Code 11
IL and Verification 16
Unsafe Code 17
The Native Code Generator Tool: NGen.exe 19
Introducing the Framework Class Library 22
The Common Type System 24
The Common Language Specification 26
Interoperability with Unmanaged Code 30

2 Building, Packaging, Deploying, and Administering


Applications and Types 33
.NET Framework Deployment Goals 34
Building Types into a Module 35
Response Files 36
A Brief Look at Metadata 38
Combining Modules to Form an Assembly 44
Adding Assemblies to a Project by Using the Visual Studio IDE 50
Using the Assembly Linker 51
Including Resource Files in the Assembly 53
Assembly Version Resource Information 54
Version Numbers 56
Culture 57
Simple Application Deployment (Privately Deployed Assemblies) 58
Simple Administrative Control (Configuration) 60

Microsoft
f is interested in hearing yourr feedbac
feedbackk about this publication so we can
What do you think
k of
o f this
this book? continually improve ourr books
bookks and learning resources forr you
you.. To participate in a brief
We want to hear from you! online survey, please visit www.microsoft.com/learning/booksurvey/

ix
x Contents

3 Shared Assemblies and Strongly Named Assemblies 65


Two Kinds of Assemblies, Two Kinds of Deployment 66
Giving an Assembly a Strong Name 67
The Global Assembly Cache 73
The Internal Structure of the GAC 77
Building an Assembly that References a Strongly Named Assembly 80
Strongly Named Assemblies Are Tamper-Resistant 81
Delayed Signing 82
Privately Deploying Strongly Named Assemblies 84
How the Runtime Resolves Type References 85
Advanced Administrative Control (Configuration) 88
Publisher Policy Control 91

Part II Working with Types


4 Type Fundamentals 97
All Types Are Derived from System.Object 97
Casting Between Types 99
Casting with the C# is and as Operators 101
Namespaces and Assemblies 103
How Things Relate at Run Time 107

5 Primitive, Reference, and Value Types 117


Programming Language Primitive Types 117
Checked and Unchecked Primitive Type Operations 121
Reference Types and Value Types 123
Boxing and Unboxing Value Types 129
Changing Fields in a Boxed Value Type by Using Interfaces
(And Why You Shouldn't Do This) 141
Object Equality and Identity 144
Object Hash Codes 147

Part III Designing Types


6 Type and Member Basics 153
The Different Kinds of Type Members 153
Type Visibility 156
Friend Assemblies 157
Member Accessibility 158
Static Classes 160
Contents xi

Partial Classes, Structures, and Interfaces 161


Components, Polymorphism, and Versioning 162
How the CLR Calls Virtual Methods, Properties, and Events 165
Using Type Visibility and Member Accessibility Intelligently 169
Dealing with Virtual Methods when Versioning Types 172

7 Constants and Fields 177


Constants 177
Fields 178

8 Methods: Constructors, Operators, Conversions, and Parameters... 183


Instance Constructors and Classes (Reference Types) 183
Instance Constructors and Structures (Value Types) 186
Type Constructors 189
Type Constructor Performance 193
Operator Overload Methods 195
Operators and Programming Language Interoperability 197
Conversion Operator Methods 199
Passing Parameters by Reference to a Method 202
Passing a Variable Number of Arguments to a Method 208
Declaring a Method's Parameter Types 210
Constant Methods and Parameters 212

9 Properties 213
Parameterless Properties 213
Defining Properties Intelligently 217
Parameterful Properties 218
The Performance of Calling Property Accessor Methods 223
Property Accessor Accessibility 224
Generic Property Accessor Methods 224

10 Events 225
Designing a Type That Exposes an Event 226
Step #1: Define a type that will hold any additional information that
should be sent to receivers of the event notification 227
Step #2: Define the event member 227
Step #3: Define a method responsible for raising the event
to notify registered objects that the event has occurred 229
Step #4: Define a method that translates the input
into the desired event 230
xii Contents

How Events Are Implemented 230


Designing a Type That Listens for an Event 232
Events and Thread Safety 234
Explicitly Controlling Event Registration and Unregistration 235
Designing a Type That Defines Lots of Events 237

Part IV Essential Types

11 Chars, Strings, and Working with Text 241


Characters 241
The System.String Type 244
Constructing Strings 244
Strings Are Immutable 246
Comparing Strings 247
String Interning 254
String Pooling 256
Examining a String's Characters and Text Elements 257
Other String Operations 259
Dynamically Constructing a String Efficiently 260
Constructing a StringBuilder Object 260
StringBuilder Members 261
Obtaining a String Representation of an Object 263
Specific Formats and Cultures 264
Formatting Multiple Objects into a Single String 268
Providing Your Own Custom Formatter 269
Parsing a String to Obtain an Object 272
Encodings: Converting Between Characters and Bytes 274
Encoding/Decoding Streams of Characters and Bytes 280
Base-64 String Encoding and Decoding 281
Secure Strings 282

12 Enumerated Types and Bit Flags 285


Enumerated Types 285
Bit Flags 291

13 Arrays 295
Casting Arrays 297
All Arrays Are Implicitly Derived from System.Array 300
All Arrays Implicitly Implement IEnumerable, I C o l l e c t i o n , and I L i s t 300
Contents xiii

Passing and Returning Arrays 302


Creating Non-Zero-Lower Bound Arrays 303
Array Access Performance 304
Unsafe Array Access and Fixed-Size Array 309

14 Interfaces 311
Class and Interface Inheritance 312
Defining an Interface 312
Inheriting an Interface 314
More About Calling Interface Methods 316
Implicit and Explicit Interface Method Implementations
(What's Happening Behind the Scenes) 317
Generic Interfaces 319
Generics and Interface Constraints 321
Implementing Multiple Interfaces That Have the Same
Method Name and Signature 322
Improving Compile-Time Type Safety with Explicit Interface
Method Implementations 323
Be Careful with Explicit Interface Method Implementations 325
Design: Base Class or Interface? 328

15 Delegates 331
A First Look at Delegates 331
Using Delegates to Call Back Static Methods 334
Using Delegates to Call Back Instance Methods 335
Demystifying Delegates 336
Using Delegates to Call Back Many Methods (Chaining) 340
C#'s Support for Delegate Chains 345
Having More Control over Delegate Chain Invocation 345
C#'s Syntactical Sugar for Delegates 347
Syntactical Shortcut #1: No Need to Construct a Delegate Object 348
Syntactical Shortcut #2: No Need to Define a Callback Method 348
Syntactical Shortcut #3: No Need to Specify Callback
Method Parameters 351
Syntactical Shortcut #4: No Need to Manually Wrap Local Variables
in a Class to Pass Them to a Callback Method 351
Delegates and Reflection 354
xiv Contents

16 Generics 359
Generics in the Framework Class Library 364
Wintellect's Power Collections Library 365
Generics Infrastructure 366
Open and Closed Types 367
Generic Types and Inheritance 369
Generic Type Identity 371
Code Explosion 372
Generic Interfaces 372
Generic Delegates 373
Generic Methods 374
Generic Methods and Type Inference 375
Generics and Other Members 377
Verifiability and Constraints 377
Primary Constraints 380
Secondary Constraints 381
Constructor Constraints 382
Other Verifiability Issues 383

17 Custom Attributes 387


Using Custom Attributes 388
Defining Your Own Attribute Class 391
Attribute Constructor and Field/Property Data Types 395
Detecting the Use of a Custom Attribute 396
Matching Two Attribute Instances Against Each Other 401
Detecting the Use of a Custom Attribute Without Creating
Attribute-Derived Objects 403
Conditional Attribute Classes 407

18 Nullable Value Types 409


C#'s Support for Nullable Value Types 411
C#'s Null-Coalescing Operator 413
The CLR Has Special Support for Nullable Value Types 413
Boxing Nullable Value Types 413
Unboxing Nullable Value Types 414
Calling GetType via a Nullable Value Type 415
Calling Interface Methods via a Nullable Value Type 415
Contents xv

Part V CLR Facilities


19 Exceptions 419
The Evolution of Exception Handling 420
The Mechanics of Exception Handling 422
The t r y Block 423
The catch Block 423
The f i n a l l y Block 425
Common Language Specification (CLS) and Non-CLS Exceptions 426
What Exactly Is an Exception? 427
The System.Exception Class 429
FCL-Defined Exception Classes 430
Throwing an Exception 433
Defining Your Own Exception Class 433
How to Use Exceptions Properly 436
Validate Your Method's Arguments 437
Use F i n a l l y Blocks Liberally 440
Don't Catch Everything 441
Gracefully Recovering from an Exception 442
Backing Out of a Partially Completed Operation When an Unrecoverable
Exception Occurs 443
Hiding an Implementation Detail to Maintain a "Contract" 444
Performance Considerations 447
Unhandled Exceptions 449
Exception Stack Traces 451
Debugging Exceptions 453

20 Automatic Memory Management (Garbage Collection) 457


Understanding the Basics of Working in a Garbage-Collected Platform 458
Allocating Resources from the Managed Heap 459
The Garbage Collection Algorithm 461
Garbage Collections and Debugging 465
Using Finalization to Release Native Resources 468
Guaranteed Finalization Using C r i t i c a l F i n a l i z e r O b j e c t Types 469
SafeHandle and Its Derived Types 470
Interoperating with Unmanaged Code by Using SafeHandle Types 473
Using Finalization with Managed Resources 475
What Causes Finalize Methods to Be Called 477
Finalization Internals 479
xvi Contents

The Dispose Pattern: Forcing an Object to Clean Up 482


Using a Type That Implements the Dispose Pattern 486
C#'s using Statement 489
An Interesting Dependency Issue 492
Manually Monitoring and Controlling the Lifetime of Objects 493
Resurrection 501
Generations 502
Other Garbage Collection Features for Use with Native Resources 507
Predicting the Success of an Operation That Requires a Lot of Memory 511
Programmatic Control of the Garbage Collector 513
Other Garbage Collector Performance Topics 515
Synchronization-Free Allocations 517
Scalable Parallel Collections 517
Concurrent Collections 518
Large Objects 519
Monitoring Garbage Collections 519

21 CLR Hosting and AppDomains 521


CLR Hosting 521
AppDomains 525
Accessing Objects Across AppDomain Boundaries 527
AppDomain Unloading 538
How Hosts Use AppDomains 539
Console and Windows Forms Applications 539
Microsoft Internet Explorer 540
Microsoft ASP.NET Web Forms and XML Web Services Applications 540
Microsoft SQL Server 2005 541
The Future and Your Own Imagination 541
Advanced Host Control 541
Managing the CLR by Using Managed Code 542
Writing a Robust Host Application 543
How a Host Gets Its Thread Back 544

22 Assembly Loading and Reflection 549


Assembly Loading 549
Using Reflection to Build a Dynamically Extensible Application 553
Reflection Performance 554
Discovering Types Defined in an Assembly 555
What Exactly Is a Type Object? 556
Contents xvii

Building a Hierarchy of Exception-Derived Types 558


Constructing an Instance of a Type 560
Designing an Application That Supports Add-lns 562
Using Reflection to Discover a Type's Members 565
Discovering a Type's Members 566
BindingFlags: Filtering the Kinds of Members That Are Returned 571
Discovering a Type's Interfaces 571
Invoking a Type's Members 574
Bind Once, Invoke Multiple Times 578
Using Binding Handles to Reduce Working Set 582

23 Performing Asynchronous Operations 585


How the CLR Uses Windows Threads 586
Pontificating about Efficient Thread Usage 586
Introducing the CLR's Thread Pool 589
Limiting the Number of Threads in the Thread Pool 590
Using the Thread Pool to Perform an Asynchronous
Compute-Bound Operation 592
Using a Dedicated Thread to Perform an Asynchronous
Compute-Bound Operation 594
Periodically Performing an Asynchronous Compute-Bound Operation 596
A Tale of Three Timers 598
Introducing the Asynchronous Programming Model 599
Using the APM to Perform an Asynchronous l/O-Bound Operation 600
The APM's Three Rendezvous Techniques 602
The APM's Wait-Until-Done Rendezvous Technique 602
The APM's Polling Rendezvous Technique 605
The APM's Method Callback Rendezvous Technique 607
Using the APM to Perform an Asynchronous Compute-Bound Operation 612
The APM and Exceptions 614
Important Notes about the APM 615
Execution Contexts 617

24 Thread Synchronization 621


Memory Consistency, Volatile Memory Access, and Volatile Fields 622
Volatile Reads and Writes 625
C#'s Support for Volatile Fields 626
The Interlocked Methods 629
The Monitor Class and Sync Blocks 630
xviii Contents

The "Great" Idea 630


Implementing the "Great" Idea 631
Using the Monitor Class to Manipulate a Sync Block 633
Synchronizing the Way Microsoft Intended 633
Simplifying the Code with C#'s lock Statement 634
Synchronizing Static Members the Way Microsoft Intended 635
Why the "Great" Idea Isn't So Great After All 636
The Famous Double-Check Locking Technique 639
The ReaderWriterLock Class 642
Using Windows Kernel Objects from Managed Code 643
Calling a Method When a Single Kernel Object Becomes Signaled 646

Index 649

What do you think off this


this book? Microsoft
f is interested in hearing yourr feedbac
feedbackk about this publication so we can
continually improve ourr books
bookks and learning resources forr you.
you. To participate in a brief
from
We want to hearr fro myyou! online survey,
y please
p visit: www.microsoft.com/learning/booksurvey/
g y
Foreword
For this book, I decided to
ask my son Aidan to write the
foreword. Aidan is almost
three years old, but he has
been hearing about the
common language runtime,
the C# programming lan-
guage, and the Framework
Class Library since his birth.
By now, he must have picked
up a lot of knowledge by way
of osmosis. One day, 1 was
sure that if he heard about
exception handling one more
time, he would just vomit.
Turns out I was right.

Aidan has also known me his whole life, and I thought it might be appropriate for him to
include a few words about me in the foreword. After explaining to Aidan what a foreword is
and what I'd like him to write about, I let him sit on my lap in my office and type away. At first
he seemed to be experiencing writer's block, so 1 started him off, but then he took it from
there. As his father, I am impressed with his eloquent prose. 1 feel that his thoughts are heart-
felt and truly reflect how he feels about me and the .NET Framework.

The .NET Framework is a fantastic technology that makes developers more productive
and my daddy explains it in such a way that
iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiioiiiiiiiiiiiiiiiiiiii
iiiiiiiiiiiiiiiiiiit

jgh lkhiuhr ,g463wh/'[]

| \0oj c ';sdf vc87

'o c.kll/k; bnyu, hjk jvc bmjkmjmbm , yfg b bvxujjv5rbhig ikhjvc bkti h thbt gl;hn
;gkkjgfhjj nbioljhlnfmhklknjmvgib

9h
- Aidan Richter, December 19, 2005

xix
Introduction
Over the years, Microsoft has introduced various technologies to help developers architect
and implement code. Many of these technologies offer abstractions that allow developers to
think about solving their problems more and think about the machine and operating system
less. Here are some examples:

• The Microsoft Foundation Class library (MFC) offered a C++ abstraction over GUI
programming. Using MFC, developers could focus more on what their program should
do and they can focus less on message loops, window procedures, window classes, and
so on.
• With Microsoft Visual Basic 6 and earlier, developers also had an abstraction that made
it easier to build GUI applications. This abstraction technology served a purpose similar
to MFC but was geared towards developers programming in Basic, and it gave different
emphasis to the various parts of GUI programming.
• Microsoft's ASP technology offered an abstraction allowing developers to build active
and dynamic Web sites by using Visual Basic Script or JScript. ASP allowed developers to
focus more on the Web page content and less on the network communications.
• Microsoft's Active Template Library (ATL) offered an abstraction allowing developers to
more easily create components that could be used by developers working in multiple
programming languages.

You'll notice that each of these abstraction technologies was designed to make it easier for
developers focusing on a particular scenario such as GUI applications, Web applications, or
components. If a developer wanted to build a Web site that used a component, the developer
would have to learn multiple abstraction technologies: ASP and ATL. Furthermore, the devel-
oper would have to be proficient in multiple programming languages since ASP required
either Visual Basic Script or JScript, and ATL required C++. So while these abstraction technol-
ogies were created to help us, they were still requiring developers to learn a lot. And fre-
quently, the various abstraction technologies weren't originally designed to work together,
so developers fought integration issues.

Microsoft's goal for the .NET Framework is to fix all of this. You'll notice that each of the afore-
mentioned abstraction technologies was designed to make a particular application scenario
easier. With the .NET Framework, Microsoft's goal is not to provide an abstraction technology
for developers building a particular kind of application, Microsoft's goal is to provide an
abstraction technology for the platform or Microsoft Windows operating system itself. In
other words, the .NET Framework raises the abstraction level for any and all kinds of applica-
tions. This means that there is a single programming model and set of APIs that developers
will use regardless of whether they are building a console application, graphical application,
Web site, or even components for use by any of these application types.

xxi
xxii Introduction

Another goal of the .NET Framework is to allow developers to work in the programming lan-
guage of their choice. It is now possible to build a Web site and components that all use a sin-
gle language such as Visual Basic or Microsoft's relatively new C# programming language.

Having a single programming model, API set, and programming language is a huge improve-
ment in abstraction technologies, and this goes a very long way toward helping developers.
However, it gets even better because these features also mean that integration issues also go
away, which greatly improves testing, deployment, administration, versioning, and re-usability
and re-purposing of code. Now that I have been using the .NET Framework myself for several
years, I can tell you for sure that I would never go back to the old abstraction technologies and
the old ways of software development. If I were being forced to do this, I'd change careers!
This is how painful it would be for me now. In fact, when I think back to all of the program-
ming I did using the old technologies, I just can't believe that we programmers put up with it
for as long as we did.

The Development Platform: The .NET Framework


The .NET Framework consists of two parts: the common language runtime (CLR) and the
Framework Class Library (FCL). The CLR provides the programming model that all applica-
tion types will use. The CLR includes its own file loader, memory manager (the garbage col-
lector), security system (code access security), thread pool, and so on. In addition, the CLR
offers an object-oriented programming model that defines what types and objects are and
how they behave.

The Framework Class Library provides an object-oriented API set that all application models
will use. It includes type definitions that allow developers to perform file and network I/O,
scheduling tasks on other threads, drawing shapes, comparing strings, and so on. Of course,
all of these type definitions follow the programming model set forth by the CLR.

Microsoft has actually released three versions of the .NET Framework:

• The .NET Framework version 1.0 shipped in 2002 and included version 7.0 of
Microsoft's C# compiler.
• The .NET Framework version 1.1 shipped in 2003 and included version 7.1 of
Microsoft's C# compiler.
• The .NET Framework version 2.0 shipped in 2005 and included version 8.0 of
Microsoft's C# compiler.

This book focuses exclusively on the .NET Framework version 2.0 and Microsoft's C# com-
piler version 8.0. Since Microsoft tries to maintain a large degree of backward compatibility
when releasing a new version of the .NET Framework, many of the things I discuss in this
book do apply to earlier versions, but I have not made any attempts to address things that are
specific to earlier versions.
Introduction xxiii

Version 2.0 of the .NET Framework includes support for 32-bit x86 versions of Windows as
well as for 64-bit x64 and IA64 versions of Windows. A "lite" version of the .NET Framework,
called the .NET Compact Framework, is also available for PDAs (such as Windows CE) and
appliances (small devices). On December 13, 2001, the European Computer Manufacturers
Association (ECMA) accepted the C# programming language, portions of the CLR, and por-
tions of the FCL as standards. The standards documents that resulted from this has allowed
other organizations to build ECMA-compliant versions of these technologies for other CPU
architectures as well as other operating systems. Actually, much of the content in this book is
about these standards, and therefore, many will find this book useful for working with any
runtime/library implementation that adheres to the ECMA standard. However, this book focuses
specifically on Microsoft's implementation of this standard for desktop and server systems.

Microsoft Windows Vista ships with version 2.0 of the .NET Framework, but earlier versions
of Windows do not. However, if you want your .NET Framework application to run on earlier
versions of Windows, you will be required to install it manually. Fortunately, Microsoft does
make a .NET Framework redistribution file that you're allowed to freely distribute with your
application.

The .NET Framework allows developers to take advantage of technologies more than any ear-
lier Microsoft development platform did. Specifically, the .NET Framework really delivers on
code reuse, code specialization, resource management, multilanguage development, security,
deployment, and administration. While designing this new platform, Microsoft also felt that it
was necessary to improve on some of the deficiencies of the current Windows platform. The
following list gives you just a small sampling of what the CLR and the FCL provide:

• Consistent programming model Unlike today, when commonly some operating system
facilities are accessed via dynamic-link library (DLL) functions and other facilities are
accessed via COM objects, all application services are offered via a common object-
oriented programming model.
• Simplified programming model The CLR seeks to greatly simplify the plumbing and
arcane constructs required by Win32 and COM. Specifically, the CLR now frees the
developer from having to understand any of the following concepts: the registry,
globally unique identifiers (GUIDs), IUnknown, AddRef, Release, HRESULTs, and so
on. The CLR doesn't just abstract these concepts away from the developer; these con-
cepts simply don't exist in any form in the CLR. Of course, if you want to write a .NET
Framework application that interoperates with existing, non-.NET code, you must still
be aware of these concepts.
• Run once, run always All Windows developers are familiar with "DLL hell" versioning
problems. This situation occurs when components being installed for a new application
overwrite components of an old application, causing the old application to exhibit
strange behavior or stop functioning altogether. The architecture of the .NET Frame-
work now isolates application components so that an application always loads the
components that it was built and tested with. If the application runs after installation,
the application should always run.
Random documents with unrelated
content Scribd suggests to you:
Through the hot brown streets of Nineveh a merchant of Phoenicia
hawked his wares. His frame, once huge and splendid in its strength,
was bent with seeming age, and a grey beard fell to the belt of his
trailing robe. Before him, by a leathern strap about his neck, hung a
wooden tray whereon his trinkets were displayed, baubles of
polished metal, beads of coral and of carven wood, rings, amulets,
and fragrant scents. Here, too, were bracelets, chains of many links,
scarfs of web-like fabrics and of gaudy hue, colored with the secret
dyes from the Sea of the Setting Sun.
From street to street the merchant pushed his way, while ever
and anon he raised his voice in a strange shrill cry which drew
attention to himself and to his wares; and thus he bartered among
the foolish wives of Nineveh. Yet at last he wandered past the
market-place to the richer quarters of the city, and came to the
central mound whereon sat the palace of the King. To the westward
terraced slopes ran down to the level of the streets and to smooth,
wide avenues which stretched to the river gate; yet here, where the
merchant walked, the walls of the mound rose twenty cubits,
masking the royal gardens which drowsed in the noon-day heat.
Again and yet again from the old man's throat came his strange,
harsh call, resembling the cry of a startled crane in flight; then,
presently, he paused at the joyous barking of a dog and a woman's
voice in sharp admonishment: "Peace, Habal, peace!"
The merchant hurried onward, yet at the entrance of a narrow
lane he turned, cried out once more and disappeared, while within
the gardens Semiramis hid a smile and sought to soothe the whining
of a shepherd's dog.
When noontide came again, the merchant once more wandered
past the garden walls, and now a captain of the guard came out to
him.
"Hey, old man!" the soldier called. "Come, follow me, for the
Princess Sozana would look upon your wares."
"Nay," said the merchant, smiling as he shook his head, "my
trinkets deck the charms of common maidens in the market-place.
The daughter of a king would scorn them, for their price is small."
So spoke the merchant, and smiled once more as he turned
upon his heel, but the captain caught him roughly by the robe and
whispered into his ear:
"Fool! The Princess Sozana asks but once to look upon a
merchant's tray. Come quickly, lest I urge your pace by a spear-point
in your hams."
The old man trembled at the threat, and followed meekly,
through a door of bronze which pierced the wall. At the head of a
narrow flight of steps he reached the gardens which King Ninus
made for the pleasure of his idle hours. There were palms and vines
from Syria, flowers from an hundred lands, trees and shrubs which
were strange to the merchant's eyes, and fragrant thickets interlaced
by tiny paths. Here a fountain bubbled, and there an artificial spring
gushed forth as though by nature moistening the earth, while
countless birds of brilliant plumage fluttered down to drink.
Of a sudden the merchant and his guide came face to face with
those who had sent the summons. Beneath an arbor on a bench of
stone sat the Princess Sozana in a green simar which was wrought
with precious gems and with threads of gold. At her side lazed
Semiramis, robed in white; yet, unadorned, her beauty far outshone
the daughter of the King. At Sozana's feet lay Prince Memetis, the
Egyptian hostage, toying with her veil which was cast aside, and
behind them stood an Afgan mute who waved a monster fan of
plumes. None else was near, save Kishra, chief eunuch of the palace-
guard whom Ninus had left in charge of his household and his
prisoners, and who now in watchful silence sat apart, his sharp eyes
resting on the merchant's face.
The old man knelt, bent forward till his forehead touched the
earth, and sprinkled dust upon his head; then, kneeling still, he
displayed his wares to the women's listless gaze. One by one he
raised them from his tray, expounding their virtues or the potency of
sacred amulets; yet none were pleasing to Sozana's mind.
"See," she pouted, plucking at the sleeve of Semiramis, "there is
naught save jingling rubbish such as slaves may wear. Wherefore
shouldst thou bring this merchant from the streets to weary me? Ho,
Kishra! Bid the man begone."
The eunuch strode forward, but Semiramis stayed him with a
lifted hand.
"Nay," she pleaded, "I did but think to ease the dullness of the
hour, and the baubles please me, for many of the like have I seen in
Syria."
The merchant raised his head, a light of hope within his eyes;
then he fumbled in a hidden corner of his tray, producing a tiny fish
which was carven in malachite and suspended by a leathern stong.
"Ah!" cried Semiramis, and clapped her hands. "Look, Sozana!
'Tis a symbol of Dagon which the Syrian shepherds wear about their
necks when they roam the hills by night. Buy it for me, Kishra, for
'twill keep off evil, bringing peace to me and to those who serve."
The eunuch scowled, but did her bidding, while Semiramis
turned once more to the trinket tray.
"Dost know the land of Syria, old man?"
"Aye, lady," the merchant answered with sparkling eyes, "from
the slopes of Lebanon to the Sea of Death—from Jordan where
dwells the Sons of Israel to Azapah and the valley of Ascalon—"
"Sweet Ishtar!" cried Semiramis, flinging up her hands. "My
home, Sozana! He hath journeyed even to my home in Ascalon!"
She laughed and turned to the merchant once again, for now in
truth she knew that Huzim hid beneath the Phoenician's robe.
"Speak," she commanded, in the Syrian tongue which was strange to
Kishra and her friends, "speak, for they may not understand. What
message from my lord?"
So Huzim answered her and told of the danger-snares which
beset his master round about. He told of the battle in the pass, of
the wrath of Ninus, and of how the King made proclamation of the
prize to him who should first stand conqueror on the citadel of
Zariaspa. He spoke of all which Menon had commanded him, and
though his words were heavy with the weight of fear, yet Semiramis
nodded in seeming happiness and clapped her hands.
"What telleth he?" Sozana asked, and Semiramis answered with
a joyous smile:
"He telleth of my lake which sparkleth like unto a jewel among
the hills; of my fishes that swim therein, and of Dagon's little temple
on the shore. I see the sheep that browse by day, till the sun is low
behind the desert's rim, and one by one the shepherds' fires leap,
twinkling, through the dusk. Ah, Sozana, mine, 'tis like unto the joy
of Prince Memetis when he dreameth by night of his silver Nile and
the mighty pyramids."
Sozana, turning, cast a look of tenderness on him who smiled
into her eyes, and suffered her hand to linger when the Egyptian
raised it to his lips.
"Say on," begged Semiramis of the merchant once again, "for I
tell you, friend, when first I heard your hunter's call in the streets
below, my heart was set a-leaping, even as Habal loosed his tongue
in honest joy. Poor Habal! I have shut him in my chamber, lest in his
gladness he spring upon your breast and thereby undeceive this
eunuch Kishra, who even now regardeth you with a doubting eye.
Be, therefore, brief. What more of my troubled lord?"
"Mistress," replied the faithful Indian, "he urgeth that we steal
away from Nineveh by craft and journey to the land of Prince
Boabdul, whither the master followeth when my messenger shall
bear him word that all is well."
"So be it," said Semiramis, puckering her brows. "Kishra, bear a
draught of wine to this aged man who is athirst and would now
depart."
The chief of eunuchs departed on her errand, and in his
absence Semiramis spoke quickly, albeit she smiled the while:
"Go, Huzim, and sell your wares through Nineveh by day, yet
wait by night on the further river-bank where the water lilies grow. If
seven nights pass by and I come not to the place, then walk once
more by the garden wall, and Sozana shall summon you again. Buy
baubles of Egypt, Huzim, for her lover is of that land, and trifles will
seem of value in her sight; yet if Ishtar smileth I will win to the river-
bank and journey to Arabia as my lord hath willed."
When Kishra returned with a cup of wine, the Princess listened
eagerly to the merchant's tale of a ring he had seen and would seek
to find. It was fashioned, he said, of yellow metal in the form of two
serpents intertwined. It was set with moon-stones, jewels sacred to
the goddess Isis who shed her light on the land of Pharaohs far
beyond the sea; and Sozana laughed in happiness, urging that he
buy this ring though it brought the price of an hundred slaves. The
merchant promised as he drank his wine, then, once more bowing
till his forehead touched the earth, he departed whence he came. In
the streets below he smiled as he hawked his wares, while those in
the garden heard his voice uplifted ever and anon in the cry of a
startled crane.
Three days passed by, and Semiramis whipped her brain for
means of escape from Nineveh; yet all in vain, for liberty seemed as
far denied as though her limbs were weighted down by chains. On
the parapets of the garden wall paced sentinels from dawn till dawn
was come again, so that none might pass unchallenged or
unscathed. The palace was but a prison perched on its lofty mound,
and though its halls still swarmed with servants and with slaves, its
portals were sealed while the King made war on Bactria. By night
Semiramis shared the chamber of Sozana, yet the door she might
not pass, for across its threshold the eunuch Kishra lay, the curtain-
rope made fast to a copper bracelet on his waist. If by chance she
could cross the watch-dog's form to the gardens beyond and
clamber down the brick-built mound, she still must face the barrier
of the city wall or the brazen gates closed fast in the hours of night.
True, bribery of the sentinels might buy a path to the river-bank,
whence swimming the Tigris would be as play to the daughter of
Derketo; yet, one false step—one virtuous fool who scorned to
barter honesty for coin—and Huzim might wait among the lily beds
in vain.
Full many a wakeful hour Semiramis stared through the opening
in the roof, with eyes which followed not the shimmering stars, nor
the chariot of Ishtar rolling down the sky. To her troubled brain came
a thousand daring plans, each smiling hope, each ending in a jeer of
mockery, till her head grew hot, and anger rose to devour her in its
might. What! Was she, the child of gods, to be balked at every turn,
when love cried out and Menon battled with his fate alone? Nay, by
the breath of Gibil, this thing was not to be! Gold she had none
wherewith to buy release, nor jewels to tempt a captor's lust for
wealth; and yet— Of a sudden Semiramis laughed aloud, till the fair
Sozana stirred, awaking with a cry.
"Nay, child, 'tis naught," the Syrian whispered, as she stroked a
trembling hand. "Hush, sweet; I did but dream, and the spirits of the
night have brought me words of wisdom and of peace."

* * * * *

The eunuch Kishra sat beneath a palm, his mind a prey unto vexious
thought. He was hideous to look upon, with a bloated paunch, a
thick-lipped mouth, and crafty eyes which peeped from their pouch-
like rims. Long had he served in the household of the King, and now
was chief of the palace-guard and warden of the chambers where
the women dwelt. When Ninus marched to Bactria, the rearward
wing of the palace had been sealed, and, together with the gardens,
was set apart for Sozana and Semiramis, while Memetis, the
Egyptian hostage, was confined in a distant court, in charge of an
under-chief. Now the Princess had pined for the presence of him she
loved, and sought by bribery to have him brought to her; yet Kishra
feared the wrath of Ninus, and naught would move him. Sozana
then contrived, through her tire-maid Nissa, to bribe the guard who
paced before the Egyptian's door, and in secret this maiden bore
many a tender message to and fro, till she came at last to a grievous
end.
Kishra once marked her stealing from a shadowy passage-way,
and on the morrow he lay in wait, following upon her heels and
listening while Memetis whispered with the maid. In the knowledge
of being thus befooled, so great was his rage that he fell upon Nissa
and slew him with his sword, too late repenting the folly of his deed.
With the Princess he sought to excuse himself, but for once Sozana
forgot her gentle mien and rose in wrath.
"Dog!" she cried, "your life shall pay for the murder of this child,
for I swear by Asshur to see you crucified upon the garden wall."
Now the eunuch knew that Ninus loved his daughter utterly, and
at her pleading, would surely nail him to the mortar between the
bricks; so he groveled at her feet with tears and prayers, beseeching
that she speak no word on the King's return; yet the Princess
spurned him with her foot and refused to heed, till Semiramis spoke
softly into her ear, then the maiden's cheeks grew red again with a
rosy flush.
"Kishra," she answered, "I will spare your worthless life, yet
exact a price therefor. Memetis shall come each morning to the
garden here, and, beneath your sight, remain till the evening hour.
Do this, and silence holds my tongue. Refuse, and the god of
darkness claims you for his own."
Thus it came to pass that the eunuch, in his dread of being
crucified, suffered Sozana to have her will, albeit, at very sight of the
Egyptian, his blood became as water in his veins. If Ninus learned
that Memetis came each day to the women's dwelling-place, short
shift would the chief of guards receive, and Ninus was prone to
beset the passing of a man with pain. Thus Kishra roasted betwixt
two fires of woe, and because of all these things he pondered much
upon his lot, and his sleep was fraught with evil dreams.
As he now sat pondering beneath the palm, Semiramis and
Sozana talked with Prince Memetis on a distant garden-seat. This
oft' occurred, yet now there was somewhat in their manner which
annoyed the eunuch's thoughts, for they whispered, with their heads
held close together, while ever and anon they glanced to where
Kishra sat, and laughed as at some merry jest. So the eunuch waxed
suspicious of their murmurings; yet, when he came toward them,
they straightway ceased to smile and began to speak of the garden
birds, the flowering plants, or the heat of the mid-day sun.
Throughout the day they counseled among themselves in secret,
with fingers upon their lips and many a swift, mysterious sign, till
Kishra sweated because of curiosity.
All night he cudgeled at his brain for means by which to
overhear their words, and ere the dawn he bethought him of a plan.
Behind the garden-seat, whereon the conspirators were wont to loll,
was a muddy fish pond surrounded by overhanging shrubs; and here
the eunuch submerged himself, with his chin upon the bank, his fat
head covered by a mass of matted vines. In this retreat he waited
for a weary space, yet the plotters came at last, seating themselves
a spear's length from the listener's open ears.
"Hast found a messenger?" Sozana asked, in a voice subdued.
"S-h-h-h! Have a care," the Syrian cautioned, with a finger
against her lip; "the fox is listening, perchance. Keep watch,
Memetis, lest he steal upon us suddenly."
Kishra grinned from his covert in the pond, but gave no sign;
then Semiramis drew from her bosom the little fish of malachite
which was bought from the merchant of Phoenicia.
"Of a truth," said she, "the messenger hath been found, and
under Kishra's very nose. Two nights he waiteth in the street below,
till I give him warning by a night-bird's cry and cast this trinket from
the garden wall. See! I have marked it with a secret sign, for proof
to my lord in Bactria that the runner speaketh truth."
"Ah!" sighed Sozana. "And, seeing it, he will come to thee?"
"Aye," returned Semiramis, with a smile of joy, "as fast as
Scimitar can bear him on his way. Upon his coming, then will I
escape from Nineveh, and with my dear lord cross the Tigris, where
we dig our buried treasure from the earth, and—"
"Treasure!" cried Memetis. "Nay, of this thou has spoken naught
before."
"Hush!" begged Semiramis, clutching at his arm. "Methought I
marked a movement in the shrubbery. Go see, Memetis, for Kishra
would give an eye to learn of what I tell."
The Egyptian rose and beat about the undergrowth, but found
no sign of him who watched, for the eunuch lay as a dead man in
the pond, scarce breathing, though his heart was pounding in his
breast. A treasure! This, then, was why the plotters whispered
secretly. Fools! The fox's teeth, perchance, might sink beneath the
feathers when he snapped.
"'Tis naught," the Egyptian made report, as he came once more
to the garden-seat. "Say on, Shammuramat, for none can overhear."
"Mayhap," the Syrian laughed, "it were wiser that I held my
tongue, yet ye who love me will ever be discreet. When we
journeyed from Azapah to the court of Ninus, I bore a store of
jewels in a leathern sack; and, knowing not if the King would smile
or frown, I buried it on the river's further bank against a time of
need. Ah, Sozana, thou who loveth gems, shouldst look upon this
store! There are pearls from India, rubies from beyond the Sea of
the Setting Sun, blue girasols and the opals of the Nile, zircons
gleaming as the eyes of Bêlit shine, amethysts, and corals carven in
the forms of birds and beasts. Tyre, Sidon, and the far off Heliopolis
have helped to heap this hoard. With half a kingdom might be
bought, yet now it lyeth hidden in a bed of river mud."
The Princess sighed, and Semiramis pinched her dusky cheek,
promising to keep the choicest gem of all as a wedding gift for the
little daughter of Assyria.
"Nay," Sozana smiled, "'tis not for the gems I sigh, but because
of a loved one who would depart from me. Why, sweet, wouldst
thou do this thing?"
Semiramis looked thoughtfully upon the earth and stirred a
lizard with her sandaled foot.
"Dost remember the merchant of Phoenicia who was here three
days agone? He told me of my home in Ascalon. Since then I yearn
for the smell of my dew-moist hills, for the reach of the valleys, and
my sweet, cool lake which sparkleth in its bed of rocks. The water,
Sozana!—and here I look upon a tepid spring—a fountain fed by
cisterns on the palace roof. Downward this water floweth, to trickle
weakly from the earth, while eunuchs gather it in skins and bear it
back upon the roof again. Dear Ishtar, what a flout to Nature's
pride!"
For a space the three sat silent, then the Egyptian hostage
asked:
"And if thou wouldst fly with Menon unto Ascalon, what then
would chance to Kishra when the master cometh from his wars?"
Semiramis laughed softly.
"Poor Kishra! In truth he sleepeth on the hornéd cap of Bel. The
master knoweth much concerning his servant's treachery, and hath
sworn to hang him from the highest tower in Nineveh."
There were ripples in the fish pond, but the plotters gave no
heed.
"It cometh to me," Semiramis laughed again, "that this eunuch
will gather up such treasure-store as may be wrung from those who
serve him, and fly to some distant land ere Ninus nail him to the city
gate. A villain is he, yet none may say that Kishra be a fool."
For a space they argued strategems of escape from the palace
walls, and of the journey unto Ascalon, then the three arose, and,
chattering, wandered down the garden path.
From the fish pond Kishra crawled, with an evil grin upon his
face, and made his way by stealth along the wall, a stream of muddy
water dripping from his muddy robe.
From a vine-clad arbor by the fountain's pool, Semiramis
watched him creeping through the trees, and smiled.
"Of a truth," she murmured, happily, "the poison in his blood
will work; aye, even as a raisin in a skin of vinegar."
CHAPTER XIX
THE STRATAGEM

With Kishra it came to pass as Semiramis had prophesied, for a


poison worked within his veins till he sickened and knew no peace.
Hour by hour he squatted upon the earth, while the words of the
Syrian burned into his heart:
"The master knoweth much concerning his servant's treachery,
and hath sworn to hang him from the highest tower in Nineveh!"
In sooth it were wise to hide away in some secret place where
the tramp of Assyria's hosts was but an echo down the wind, and
India offered many a safe retreat. Yet, one grown lazy at a post of
power revolts at the thought of poverty and toil, for the cup and a
savory dish were as musk to the eunuch's nose. If he could but lay
his hand on the treasure of Semiramis! To dwell in plenty and in
ease! To swing the lash above the backs of a hundred slaves! Ah,
this were peace! These jewels lay hidden in a leathern sack—a sack
concealed in a bed of river mud. Mayhap, if craft were exercised—!
Mayhap!
Long Kishra crouched, with burning eyes, with parching lips
which he moistened with a restless tongue, while the raisin worked
in a skin of vinegar. To his brain came many a cunning scheme which
faltered not at a stain of blood, till the sun-lit garden reeled before
his sight, and the pebbles in the path were as a million precious
gems which mocked his greed. Then Kishra slept, to dream of being
crucified on the brazen gates of Nineveh.
When night was come the eunuch set a guard in the streets
below, with commands to seize on all who loitered in the shadow of
the wall; then he hid himself and lay in wait.
Through the garden stole Semiramis, clothed in a sombre robe
and bearing the fish of malachite now wrapped in a veil and bound
with cords. She skirted the fountain and bent her steps toward the
east, where fewest sentries paced the parapets, and here she
paused. Kishra rejoiced that Habal followed not at the Syrian's heels,
for the eunuch's scent would speedily have caused a warning growl;
yet now the spy had removed his sandals, and his cat-like tread fell,
noiseless, on the trail.
Close in the shadow of the wall, Semiramis raised her voice in a
night-bird's cry. For a space she listened. An answering cry came
faintly back, then she raised her packet to fling it across the wall;
but behind her Kishra rose, caught the uplifted arm and wrenched
the amulet from her grasp.
With a smothered cry, Semiramis wheeled upon him, her eyes
two pools of fury, while a storm of passion bubbled to her lips.
"Hound! give back my own. What! Am I, the spouse of Syria's
Governor, to be tracked like a pilferer through the night? Have done!
Give o'er my packet and begone!"
So fiery was her mien that Kishra took a backward step, drawing
a dagger from his belt and presenting its point against attack.
"Not so," he answered, tauntingly. "When captives send forth
messengers to Bactria, a palace warden risketh the hazard of his
head."
The woman started. What if the eunuch had overheard her
whisperings and was advised of all? Yet, how could it chance, when
Memetis had watched on every hand. So Kishra read her thoughts,
for anger departed from her tongue, and in its place came a tone of
craft:
"'Tis naught, good Kishra. 'Tis naught, I swear, save a message
to my lord—a token that all is well at Nineveh—an amulet—the little
green fish which the merchant of Phoenicia sold. See, Kishra. I pray
you break the seal."
The eunuch laughed.
"True," he nodded, "'tis but a fish, and being but a fish, can wait
for a moon till the stores of grain be dispatched to the King at
Zariaspa. Thy message shall journey with the guard."
"Nay," she reasoned, "these wagon-trains are slow, and my
haste is great. To-night must it go, or to-morrow, else my runner will
come too late."
"Ah!" grinned Kishra. "Then perchance thy lord in Bactria will
reward this runner for his haste."
"Aye," replied the Syrian, "even as you shall be rewarded if you
cross me not."
"The price of broken faith is large," said the eunuch, artfully.
"How much?"
"A purse that is weighted to its very throat."
He laughed in scorn and turned away, but Semiramis caught his
robe with a swift, detaining hand.
"Listen," she urged; "if the price be small, then will I add to the
purse another purse and such ornaments as are mine—even to the
pearls that rim my sandals round."
Kishra still shook his head and withdrew his robe, retreating
through the garden, while the Syrian followed after him.
"What, then?" she pleaded, and sighed in hope to see him
pause.
For a moment he pondered, then, leaning forward till she felt
his breath upon her cheek, he whispered, hoarsely:
"The leathern sack of gems!"
Once more she started, yet controlled her voice, answering in a
tone of wonderment:
"A leathern sack of gems? In truth I know naught of it. As Bêlit
liveth, your words are the words of foolishness."
"True," grinned Kishra; "no treasure is hidden on the river bank,
nor is there a garden-seat before our eyes, nor a fish pond near at
hand where a man may hide his body beneath the scum and harken
unto whisperings."
At his taunting speech Semiramis raised her fist as if to dash it
in his evil face, then let it fall beside her, while she sank upon the
garden seat in bitter tears. The eunuch for a space stood silent, for
well he knew the value of a bridled tongue, so he waited for her
heart to battle with her mind and conquer it.
"Give me this sack," he said at length, "and thy runner shall go
unharmed."
"Nay," sobbed Semiramis, "a purse—no more."
"A half," urged Kishra, but she shook her head, again repeating
her offer of the purse.
"A third. Think, mistress, vast riches will be left to thee, and a
third is little." She made no answer, and a light of cunning crept into
his eyes. "All might I have if I willed to serve thee ill, for I know the
spot on the river bank where—"
"Liar!"
The Syrian once more faced him, trembling in her wrath.
"No eye save mine can find the hiding place, though it sought
till the sun is cold. Who, then, shall point the way for thieves?" She
laughed derisively. "Shall I, Shammuramat, go forth—disguised,
perchance, as some kitchen wench—at the heels of a sexless beast?
Nay, not till Nineveh hath rotted from the plain!" Again she laughed
and snapped her scornful fingers in the eunuch's face. "Safe by the
river my treasure lieth—a treasure for which the King might barter
half his power—yet not one gem shall fall into your grasp. Go out
and hunt the Tigris, from the mountains to the sea. Dig! and may
Gibil damn you for a fool!"
She drew her robe aside, as though she passed some thing of
pestilence, and strode away, while Kishra came pattering meekly
after her. His avarice had over-shot the mark, and failure gnawed his
bowels with the teeth of fear.
They now had reached the fountain's pool where the palace
torches glimmered through the foliage, casting strange shadows
upon the earth till the garden seemed thronged with myriads of
dancing ghosts. Here Kishra put forth his hand and grasped a fold of
the Syrian's simar.
"Heed me," he begged, and as Semiramis swung angrily about,
he began once more to bargain for the gems. "Be patient, mistress,
for my needs are sore, and I, too, would escape from Nineveh, even
as thou and thy lord will fly to Ascalon. Give me but a little part of
this treasure store and I swear to aid thee with an aid none else may
give."
Semiramis pondered thoughtfully.
"Fling my packet from the wall and I promise you a part."
But the man was not to be deceived by slippery promises.
"Nay; when the gems are in my hand, then shall the fish of
malachite be given unto thy messenger."
Their horns were locked again. Yet, a moment since, when the
Syrian had cursed him in her scorn, her words had left a maggot in
his mind. "What!" she had demanded. "Shall I, Shammuramat, go
forth to point the way for thieves—disguised, perchance, as some
kitchen wench?" Ah, if he could but bend her pride, how simple
would be the rest!
"Listen," he begged, with deep humility. "In the hour of stress
we stoop to many things. What harm if the lady Shammuramat
conceal her beauty beneath an humble cloak and fare with Kishra to
the river bank? By boat we may cross, returning ere the night is old,
and none would be the wiser, for the city gates are free to me."
"No!" declared Semiramis, with a gesture of disdain. "I trust you
not, nor will I leave the palace mound, though you prayed till dawn."
Her speech was firm, yet in it the eunuch marked a sign of
wavering, so he urged his case with a beating heart:
"The gems once buried in the garden here, we wait in peace till
Menon cometh to take thee hence, and for a third of this treasure
store a friend is made, where an enemy might balk thy every move."
His words were words of wisdom, yet the Syrian frowned in
doubt, while her sandal tapped impatiently on the graveled path.
"What will it profit," the tempter asked, "if wealth be stored
away, when he whom thou loveth shall die in a distant land?"
"What mean you?" cried Semiramis, with a gasp of fear, and
Kishra drove the nail:
"If the fish of malachite, with the message which it beareth,
shall go into Bactria, coming not to Menon, but to the King's own
hand, then in truth thy lord may suffer grievously."
At his thin-veiled threat the woman quailed, while terror leaped
into her eyes.
"Nay—nay," she pleaded, clinging to his arm, "'twere cruel to do
this thing. Be merciful, good Kishra, and I give a tenth."
The battle was won. The eunuch could scarce restrain his joy,
for in his heart an evil plan took root. The treasure once dug from
the river bank, the body of Semiramis should fill the hole; yet, lest
suspicion rise, he wrought by subtlety, grumbling at the smallness of
his pay.
"And my messenger," Semiramis demanded, "what of him? Two
days will he wait—no more. Alas, we will be too late!"
"Then come with me to-night," breathed Kishra, biting at his
nails.
The Syrian wavered, her will tossed back and forth on the
shields of doubt and love, till Kishra hinted at further ills to Menon;
then her spirit broke. Trembling from head to heel, she agreed to go,
but laid an oath upon him, and sought to bind him with a thong of
bribery.
"Kishra," she faltered, "I have promised you a tenth. Be faithful
and I give a greater part. Dost swear to guard me from every harm
and bring me in safety to the palace once again?"
In the gloom the man smiled wickedly, yet gave his pledge; then
whispered into her ear:
"Go to thy chamber, and when the princess sleepeth, creep forth
and join me at the garden-seat. An hour must pass, for I send a
messenger to the river shore to find a boat. A cloak will I have for
thee, and pigment wherewith to stain thy skin, lest the keepers of
the gate should marvel at thy comeliness. Go now, and count on
Kishra as a servant faithful to the end."
For a moment more she lingered, faltering; then bowed her
head and passed from the garden with a weary tread.
In the sleeping-chamber, Sozana drew her down beside the
couch, asking in whispered mirth:
"Didst hear my answer to the night-bird's call? How fareth the
jest with Kishra?"
"It worketh," breathed Semiramis into a tiny ear, "for the son of
fools will journey to the river bank and dig for dreams. Sleep, dear
one, and to-morrow we may laugh aloud."
Long lay Semiramis, staring through the opening in the roof,
while she waited for sleep to kiss Sozana's eyes. Her bosom heaved;
her breath came hot, impatient, from her lips. If all went well the
city would soon be left behind, and the gardens of Ninus would be
but a haunting memory. How sweet to snap the bonds of dull
captivity and face such crouching dangers as the darkness veiled!
And yet, a sorrow came to share the treasure of her joy. The
Princess and Memetis thought her plan was but a jest whereby to
trouble Kishra's peace of mind; and to-morrow they must mourn her
as one who slips away into the great unknown and leaves no trace.
Again, came a sharper pang for a friend deserted—one who would
grieve as none other save her lord might grieve—for Habal, too,
must be left behind.
Her hand stole out from the couch's edge and fell upon him in a
fond caress, while Habal licked the hand, and his tail beat happily
upon the tiles. Then Semiramis drew him up to her, and wept, with
her face deep hidden on his shaggy breast.

* * * * *

The Princess slept. Semiramis arose and moved in stealth toward the
door; yet she paused on the threshold, for her dog came creeping at
her heels.
"Down, Habal, down!" she whispered, struggling with her tears,
and the dog obeyed, though he whined because of impending evil—
a sense which is keen in the hearts of beasts, and is passing
strange.
In the garden all was still. Semiramis crept to the appointed
place where the eunuch waited, eager to begone. She smeared her
hands and face with pigment, donned a slave's simar, and hid her
flame-hued hair beneath a ragged hood; yet, when all was ready,
she hung back, trembling, till Kishra's patience broke, and he longed
to urge her on by blows.
The door of bronze, which pierced the garden wall, was opened
by a sentry who saw but the eunuch and a kitchen wench with a
basket upon her head. Oft had he seen the like before when Kishra
went forth in search of dainties for his pampered appetite; so when
the door clanged sharply at their backs, the sentry once more
nodded at his post.
As the street was reached Semiramis well-nigh swooned for joy,
and vowed a gift to Ishtar should the city gates be passed. In silence
they began to walk, when of a sudden each started at the sound as
of a body falling from the palace mound. They paused, but naught
was heard or seen, so the two set out again.
Westward their course was laid, past many a booth where
women laughed, and crafty hucksters lured them on to buy; past a
teeming market-place, for Kishra went boldly in accustomed paths,
lest marauders spring upon him from some darkened alley-way. The
place was a place of noises, lights and evil smells, of leering,
besotted crowds who knew the eunuch and gibed him because of
the woman at his side. The Syrian's blood burned hotly in her veins,
till she yearned to tear the jesters with her nails; yet wisdom
whispered, so she laughed in the manner of an easy-virtued kitchen
wench, and went her way.
And now the booths were passed, and they came at length to
the city wall with its mighty gates of brass. Here fortune once more
favored them, for a band of belated horsemen came clattering in,
the riders nodding on their weary steeds; so Kishra whispered with
the captain of the gate, slyly pressing a coin into his palm; then, as
the keeper turned his back, the two slipped by and went unnoticed
out of Nineveh.
In silence the treasure-seekers crossed the plain till they came
to the river bank. Here a boat was found in charge of an under-
keeper's boy who stretched out his hand for pay, then straightway
disappeared. Kishra produced a digging tool from beneath his cloak,
laid it beside him on the beach, and began to unloose the boat; and
while he was thus employed, Semiramis cast a lingering glance at
the city wall that loomed against the sky, so black, so stern, with its
monster towers which seemed to stand on guard like giant wardens
of the night.
As she gazed, her heart grew sad again—sad for the little
Princess dreaming on her couch, and because of Habal, watching for
the mistress who would come not back to him.
She sighed and turned; yet, turning, felt a cold nose thrust into
her hand; then with a cry of joy Semiramis fell upon her knees, her
arms clasped tight about the neck of the faithful dog. She
remembered the sound of a body falling from the palace mound;
'twas Habal that had leaped to the street below, where he lay for a
space with the breath dashed out of him, then hobbled along her
trail with a broken paw. At the city gate he had darted between the
legs of the horses filing in, and now crouched, panting, at the
Syrian's side, to receive caresses, or reproof because of his
disobedient love.
Now the coming of Habal proved a check to Kishra's plan of
murdering the woman when her treasure was in his hands; so,
cursing, he snatched up his digging tool wherewith to slay the beast;
but Semiramis sprang between them, furious as a mother who
defends her child, while the dog rose, snarling, eager for Kishra's
blood.
"Lay but a finger tip upon him," the mistress cried, "and you
hunt alone on the further shore! Have done! The dog is wounded,
and with us he shall go!"
Kishra paused. Full well he knew the risk of trifling with a
woman's whims. It were better to humor her in this little thing than
to hazard all ere the gems were in his clutch; so, grumbling, he cast
his digging tool into the boat and made ready to depart. The craft
was small, and rude of shape, yet would serve to bear them safely
to the other side; and when Semiramis and Habal had settled in the
bow, Kishra with his paddle pushed out into the stream.
"Whither, mistress?" he asked in a muffled tone, as though he
feared some lurker on the bank might hear.
"To the lily beds in line with the city gate," the Syrian
whispered, with a hidden smile, while she tore a strip from her
nether garment and bound it on Habal's broken paw.
For a space they were silent, and, as the boat slipped forward in
the gloom, dim voices of the night came floating to their ears—to
the woman, sweeter than a zittern's softest strain. She listened to
the river's droning hymn as it worshipped on its way to the Sea-
god's shrine, and the deep-toned song of frogs from a reedy marsh.
She heard the lisp of the paddle in the yellow tide, a heron's echoed
cry, and the far, faint call of sentries from the battlements of
Nineveh.
On the heart of Kishra these voices cast a spell of fear, chilling
the fever of his greed which till now had urged him on. Why should
the Syrian be overjoyed to greet her dog if she thought to return ere
the dawn had come? Perchance she laid some snare to trip his feet,
and would fly to Ascalon, cheating him of his wealth so coveted. The
treasure! Mayhap no gems were hidden there at all, and hers was
but a trick to lure him to his death.
A thousand terrors trickled from out the gloom; they swam
through the waters, climbed into the boat, and lay upon him heavily.
Of a sudden the traitor paused, with his paddle across his knees.
"Mistress," he asked, "what proof have I that no enemy lurketh
beside the lily beds, to fall upon me when we reach the shore?"
"None," replied Semiramis. "He who would dig for leathern
sacks, must dare such dangers as the night-gods send. Yet, if yours
be a coward's heart, turn back, for it cometh to me that a tenth is
usury." She smiled again, and bent to her restless dog: "Down,
Habal, down! What troubleth thee?"
The boat now floated in the middle of the stream, and ere
Kishra began his paddling once again, his fears were confirmed by
the actions of the dog. Habal had risen, sniffing at the air. On the
western breeze he caught a scent, and his bark rang out till the
echoes rolled from shore to shore. A friend was near at hand, and
the dog gave joyous tongue.
For a moment Kishra sat staring at Semiramis, while through his
evil brain shot the knowledge of his own credulity. From the first she
had gulled him, luring him to lie in a muddy fish pond, harkening
unto whisperings. No runner waited for her fish of malachite. Her
tremblings and her tears were but a mask. Even in her well-feigned
fury she had fed him with designs for his own undoing, and he, in
his gross cupidity, had eaten of the fruit of fools. No treasure lay
hidden on the river shore, but enemies who smiled and waited for
their own.
Mad with terror, Kishra spun the boat about, but, in his over-
strength of fear, the paddle snapped, and Semiramis laughed aloud.
Helpless he sat, a victim to this gloating witch who befooled him
with her guile—he—Kishra, warden of the King, who dared not
return again to his post of ease. Then fury took him utterly. He
seized on the digging tool, arose, and swung it high above his head
in the thought to brain her at a blow.
"Devil," he snarled, "thou hast tricked me with a lie!"
Down came the implement, but not upon the Syrian, for Habal
had leaped at Kishra's throat, and Semiramis overturned the tossing
craft.
For an instant all was darkness, fraught with fear; then the man
rose, gasping, clutching at the boat. A spear's length away he spied
a foaming swirl, where Semiramis flung high her arms and
disappeared.
Then the river again took up its droning hymn; the sentries
called from the distant battlements; a dog's head rode the waves as
it pointed to the westward shore, and a boat went spinning down
the Tigris, while Kishra clung in terror to its slippery keel.

CHAPTER XX
THE FLIGHT

"Ho, Huzim!" called Semiramis, as she gained a footing on the river


mud and splashed through the shallows where the lilies grew; and
Huzim, with a cry of greeting, stretched forth his hands to draw her
up upon the bank.
"Art safe?" he asked. "No hurt hath come to thee? Of a truth I
rejoiced at the voice of Habal, yet close upon it came a sound of
tumult, and my strength forsook me utterly. See, mistress, I tremble
still, for the night hath brought a terror to my heart."
In his joy the faithful servant, who would have dared the anger
of the gods themselves to shield Semiramis, sank down and clasped
her knees, to weep as a child might weep.
"Nay," laughed the woman, with a gentle hand upon his straight
black locks, "'twas naught indeed save a plunge and a joyous swim,
for the waters thronged about me with the kisses of old,
remembered friends. Up, Huzim! Bear Habal in your arms, for his leg
hath received a hurt, poor beast. And hasten! Yon apish eunuch
whirling down the stream may arise an outcry, bringing a troop of
horse upon our trail."
The Indian arose, and raising Habal as his mistress bade him,
strode forward through the darkness, while she, in the joy of
freedom, walked happily at his side, wringing the water from her wet
simar and whispering of all which had come to pass. For a league
they journeyed westward till they came to a hillock crowned by
trees, and here the Indian bade his mistress wait, while he, himself,
went onward to secure their steeds which waited in a secret place in
the wooded lands beyond.
"Keep watch," he urged, then filled his lungs with a hopeful
breath and vanished in the gloom.
Alone, the Syrian raised her eyes toward the sky and once more
listened to the voices of the night. The river's hymn was hushed; no
sentry's call rang out from distant Nineveh, and across the plains
came only a foolish wind that murmured among the trees. Yet other
voices rose in the heart of Semiramis, to cry aloud with every
quickened beat. Menon! Menon! they shouted, till the echo mounted
to the burning stars, to catch their flame and tumble back to the
heart which sent it forth. Thus cried Derketo, that mother whose
passion stirred in the daughter's blood, till her eyes grew dim in
yearning tenderness. As a song it sounded in her ears—a song of
fire and love; yet with it rose a strain more harsh, the voice of her
unknown sire—perchance a war-god from the Southern Seas. It rose
in a stern command and was taken up on the tongues of marching
multitudes, in the snarl of the battle-horn, and the rumble of
charging chariots.
To the south lay far Arabia, whence peace might follow in the
thread of love; yet Semiramis stretched her arms toward the east
where Zariaspa sat, unconquered, on the plains.
From the darkness came Huzim on the back of a goodly steed,
leading another by its bridle rein. To the saddle-skin of each was
bound a food-sack, arms, and a woolen cloak to shield the body
from the chill of night. Likewise, for Semiramis, he had brought a
brave attire, for henceforth she must travel, not as a woman, but as
a man; so, from a screen of the hillock's trees, she discarded her
wet simar and soon stepped forth in the guise of a youthful warrior.
From her shoulders hung a linen tunic, belted and falling to the
knee, while her limbs were encased in heavier cloth, bound round
with thongs. Her arms were bare, and on her head sat a brazen
helm, of a pattern worn by fighting chiefs on the Syrian coast, its
stiff rim lined with a veil of many folds.
With a laugh Semiramis leaped astride her steed, causing her
dog to be set before her on the saddle-skin, for their pace would be
swift, and Habal might not follow with his broken foot.
"See, mistress," whispered Huzim, coming to her side and
stretching forth his arm toward the south; "there lieth our road
which leadeth by devious ways to the desert home of Prince
Boabdul, whence we journey at my lord's command."
"Aye," the Syrian nodded, "'twas even so two moons agone, yet
now the world hath somehow gone awry, till Arabia no longer lieth in
the south. Come, hasten! that we catch this wandering land ere it
shift again."
With another laugh she wheeled her steed and raced toward the
north, while for an instant Huzim gazed after her, his jaws agape in
wonderment; then he cursed, and spurred upon her track. For a
space she held the lead, till the Indian cut it down and at last
stretched forth his hand which closed on her bridle-rein.
"How now," he cried, when the steeds had come to a fretful
stand, "what madness wouldst thou do? Come, turn southward, for
to Arabia we journey, else Huzim must first be slain."
For the first time since the battle with the Kurds she marked a
frown of anger upon the servant's brow, yet little she reckoned of
the wrath of any man.
"Huzim," she answered, and her teeth shone white in the light
of a riding moon, "I know not what path is best for fools to take, nor
if you would hide in idleness beneath the desert's sands; but as for
me, as Ishtar hears my oath, I go to Bactria."
"But why?" he demanded, in a tone of keen despair. "Why
tempt the gods when wisdom pointeth out the way?"
Once more Semiramis raised her arms toward the stars, and her
fists were clenched.
"To join my lord and share the perils which are his; to wrest a
loved one from the toils which hedge him round about, or drive my
hunting spear through the body of Assyria's King!"
In vain the Indian pleaded; in vain he besought her with prayers
and tears to discard a plan so mad, but she paid no heed.
"What!" she demanded, "am I born of coward's blood? Nay;
what man may do, that also will I, a woman, compass; and, failing,
the fault is mine alone. Think," she argued, "if hiding seemeth good
to you, then will we lie concealed among the crags which overtop
the plains of Bactria, whence you, good Huzim, may creep by night
into Menon's camp and guide him safely to my side. Once joined
with him, we journey where he wills, though it be to Gibil or to
Ramân's thunder-halls."
Thus in the end the reluctant Indian gave in, and they rode
toward the north, though for a space he lagged behind in troubled
silence, his chin upon his breast. As he rode it came to him that his
mistress had never held a thought of flying to Arabia, but had
curbed her tongue lest wisdom move him to prevent escape from
Nineveh. It was now too late to husband wine when the skin was
rent, so Huzim shook the anger from him, and, with one last sigh of
doubt, came up to the side of Semiramis.
For a league they held to the river bank, then forded at a
shallow point and travelled eastward swiftly till the night was gone.
And thus they fared for many days, boldly by night, and resting
throughout the day in close retreats, for they knew not if Kishra had
perchance survived to send out hunters on their trail. Poor Habal's
paw healed quickly, and soon he rode no more on the saddle-skin,
albeit a moon went by ere he ran upon four sound legs again; yet,
even with a bandaged limb, the dog served faithfully, and many a
lurking danger came to naught by reason of his warning growls.
And now they came into Media, and the fear of pursuit was lost;
so onward they pushed, avoiding the open roads. They passed
through trackless forest-lands, through verdant valleys and up again
to the crests of wooded hills, where at their feet the lands of foreign
peoples stretched far and wide, their dwelling places marked by coils
of smoke. Anon they skirted woodland villages, and, peering through
a screen of leaves, saw naked children sporting in the sun, their
naked mothers pounding grain with stones, while uncouth warriors
drowsed at ease beneath the shade. Once, on a hillside, they came
full face upon a hunter, bearing a forest pig upon his back, in his
hand a spear. For a space the man stared stupidly, then dropped his
burden, cast his spear at Huzim, and went shrieking down the slope.
From stone to stone he leaped, as leaps a mountain goat, the while
he cried out shrilly to his friends beneath; yet in his final plunge he
bore no message save a shaft between his shoulder blades.
"Of a truth," sighed Huzim, "'twas pity to slay the fool, yet wise,
perchance, for his tribesmen know not if we be an army or a single
man. Come, hasten, mistress, lest his friends be cursed with curious
minds."
They hastened on, and for a space no other mischief came to
trouble them, though many evils stalked abroad by night and day;
yet these were passed because of Huzim's cunning woodcraft, and
Habal's wit in scenting peril from afar. Then, when the skin of
Semiramis was tanned to a ruddy brown, and the steeds were lean
and weary from their toil, the travellers neared the foothills of Hindu-
Kush, to fall upon a grave mischance. They had come to a forest's
edge, where a sloping plain of a league in width stretched out before
them, ascending to the mountain steeps beyond; and here the
Indian counseled that they lie concealed till the shades of night
should fall, but Semiramis would have none of it.
"Nay," she urged; "I burn to reach the mountain top for a peep
into the land of Bactria, and to know, perchance, if my lord still
battleth there. Come, Huzim, lest I leave a faithful friend behind."
The servant shook his head and galloped after her, yet his hope
came back again when the middle of the plain was reached and
naught was seen save a watchful kite that swung in the blue above.
Then Habal wheeled on the backward trail, and barked. From the
forest left behind came a score of riders who spread to right and
left, then lashed their mounts and advanced in a ragged line.
"'Tis even as I feared," growled Huzim beneath his breath.
"Speed thee, mistress! We yet may win to the hills in time."
But ere they had ridden twenty paces he was fain to draw his
rein, for out from a fringe of woods ahead another band appeared,
to spread as the first had spread, with an aim of closing in upon the
fugitives. The Indian unslung his bow, casting about him for a spot
wherein to halt and hold his foes at bay, but Semiramis smiled upon
him and took command.
"Be not a child," she whispered. "Your shafts are useless, for
these our enemies outnumber us, and our steeds are spent. Obey
me and speak no word."
She drew her bridle, shielded her eyes from the sunlight's glare,
then waved her hand and dashed full speed toward the Bactrian
troop.
"In the name of the gods—!" gasped Huzim, spurring after her;
but she laughed and, once more waved her hand.
Now the horsemen, marveling at the strangeness of this move,
drew rein upon the slope and waited till their quarry came to them.
Outposts they were whom Oxyartes set beyond the mountains, to
watch all roads, to cut off messengers, and to bring report of armies
or of food-trains coming out from Nineveh.
"Ho, friends!" laughed Semiramis, pausing in their midst and
speaking in the Bactrian tongue, a deal of which she had learned
Welcome to our website – the ideal destination for book lovers and
knowledge seekers. With a mission to inspire endlessly, we offer a
vast collection of books, ranging from classic literary works to
specialized publications, self-development books, and children's
literature. Each book is a new journey of discovery, expanding
knowledge and enriching the soul of the reade

Our website is not just a platform for buying books, but a bridge
connecting readers to the timeless values of culture and wisdom. With
an elegant, user-friendly interface and an intelligent search system,
we are committed to providing a quick and convenient shopping
experience. Additionally, our special promotions and home delivery
services ensure that you save time and fully enjoy the joy of reading.

Let us accompany you on the journey of exploring knowledge and


personal growth!

ebookname.com

You might also like