TAILIEUCHUNG - Symbian OS ExplainedEffective C++ Programming for Smartphones phần 7

Trên hệ điều hành Symbian, máy chủ thường được sử dụng để quản lý truy cập chia sẻ tài nguyên hệ thống và dịch vụ. Việc sử dụng một máy chủ là hiệu quả vì nó có thể phục vụ nhiều phiên khách hàng và có thể được truy cập đồng thời của khách hàng đang chạy trong chủ đề riêng biệt. | SERVERCLASSES 207 Starts the server and constructs the shutdown object starting the timer to ensure that the server will exit even if the starting client connection fails void CHerculeanServer ConstructL StartL KServerName In case the client session fails to connect void CHerculeanServer AddSession iSessionCount Cancel the shutdown timer now Decrement the session counter. Start the shutdown timer when the last client disconnects void CHerculeanServer RemoveSession if --iSessionCount 0 TInt CHerculeanServer RunError TInt aError if KErrBadDescriptor aError PanicClient Message EPanicBadDescriptor else Message .Complete aError ReStart Continue reading client requests return KErrNone handled the error The construction of the CHerculeanServer class is straightforward. The shutdown timer is started when the server is first constructed in case construction of the initial client session fails. When the first session is added successfully the session count is incremented and the shutdown timer is canceled. The server object increments and decrements the iSessionCount reference count accordingly when sessions are added and removed. CHerculeanServer RunError is called if a leave occurs in CHerculeanSession ServiceL that is if one of the methods which services client requests leaves. The leave code is passed to RunError which should attempt to handle the leave returning KErrNone if it does so. CServer RunError was added to Symbian OS to allow the server to manage leaves resulting from client request processing. Previously the leaves were propagated to the active scheduler which did not have sufficient context in which to handle them. RunError panics the client if the leave code is KErrBad-Descriptor because this indicates that client data has been passed to the server without having been properly descriptorized . This is 208 THE CLIENT-SERVER FRAMEWORK IN PRACTICE indicative of a programming error so the

Đã phát hiện trình chặn quảng cáo AdBlock
Trang web này phụ thuộc vào doanh thu từ số lần hiển thị quảng cáo để tồn tại. Vui lòng tắt trình chặn quảng cáo của bạn hoặc tạm dừng tính năng chặn quảng cáo cho trang web này.