1: // * as a wildcard for the name search 2: _LIT(KFindAll, “*”); 3: // default RThread object, has a handle of the current thread 4: RThread thread; 5: TFullName fullName; 6: TFindThread finder(KFindAll); 7: 8: while (finder.Next(fullName) == KErrNone) 9:
(未完待续)
BestRegards hoolee
hoolee View Public Profile Send email to hoolee Find all posts by hoolee Add hoolee to Your Buddy List
#2 2005-04-28, 08:20 hoolee Registered User Join Date: Mar 2005 Posts: 1,037
为了防止这类情况的发生,你需要使用非抢占式client/server机制或同步对象来处理。同步对象(mutex, semaphore, critical section)都是核心对象,可以通过句柄来访问。他们会限制或直接锁住对多线程们所要访问的资源,这种资源形式被称为共享资源。 在任何时刻只能有一个线程对共享资源进行写操作,每个要访问资源的线程都应使用同步机制来管理资源。 同步操作一般有如下步骤: 1. Call Wait() of the synchronization object reserved for this resource. 2. Access the shared resource. 3. Call Signal() of the synchronization object reserved for this resource.