equal
deleted
inserted
replaced
1 // Copyright (c) 1998-2009 Nokia Corporation and/or its subsidiary(-ies). |
1 // Copyright (c) 1998-2010 Nokia Corporation and/or its subsidiary(-ies). |
2 // All rights reserved. |
2 // All rights reserved. |
3 // This component and the accompanying materials are made available |
3 // This component and the accompanying materials are made available |
4 // under the terms of the License "Eclipse Public License v1.0" |
4 // under the terms of the License "Eclipse Public License v1.0" |
5 // which accompanies this distribution, and is available |
5 // which accompanies this distribution, and is available |
6 // at the URL "http://www.eclipse.org/legal/epl-v10.html". |
6 // at the URL "http://www.eclipse.org/legal/epl-v10.html". |
199 EXPORT_C void NKern::UnlockSystem() |
199 EXPORT_C void NKern::UnlockSystem() |
200 { |
200 { |
201 NKern::Lock(); |
201 NKern::Lock(); |
202 TheScheduler.iLock.Signal(); |
202 TheScheduler.iLock.Signal(); |
203 NKern::Unlock(); |
203 NKern::Unlock(); |
|
204 CHECK_PRECONDITIONS(MASK_THREAD_STANDARD,"NKern::UnlockSystem"); |
204 } |
205 } |
205 |
206 |
206 |
207 |
207 /** Temporarily releases a fast mutex if there is contention. |
208 /** Temporarily releases a fast mutex if there is contention. |
208 |
209 |
444 __KTRACE_OPT(KNKERN,DEBUGPRINT("WfAR")); |
445 __KTRACE_OPT(KNKERN,DEBUGPRINT("WfAR")); |
445 NThreadBase* pC=TheScheduler.iCurrentThread; |
446 NThreadBase* pC=TheScheduler.iCurrentThread; |
446 NKern::Lock(); |
447 NKern::Lock(); |
447 pC->iRequestSemaphore.Wait(); |
448 pC->iRequestSemaphore.Wait(); |
448 NKern::Unlock(); |
449 NKern::Unlock(); |
|
450 CHECK_PRECONDITIONS(MASK_THREAD_STANDARD,"NKern::WaitForAnyRequest"); |
449 } |
451 } |
450 #endif |
452 #endif |
451 |
453 |
452 |
454 |
453 /** Sets the owner of a fast semaphore. |
455 /** Sets the owner of a fast semaphore. |
506 CHECK_PRECONDITIONS(MASK_INTERRUPTS_ENABLED|MASK_NOT_ISR,"NKern::FSSignal(NFastSemaphore*)"); |
508 CHECK_PRECONDITIONS(MASK_INTERRUPTS_ENABLED|MASK_NOT_ISR,"NKern::FSSignal(NFastSemaphore*)"); |
507 __KTRACE_OPT(KNKERN,DEBUGPRINT("NKern::FSSignal %m",aSem)); |
509 __KTRACE_OPT(KNKERN,DEBUGPRINT("NKern::FSSignal %m",aSem)); |
508 NKern::Lock(); |
510 NKern::Lock(); |
509 aSem->Signal(); |
511 aSem->Signal(); |
510 NKern::Unlock(); |
512 NKern::Unlock(); |
|
513 CHECK_PRECONDITIONS(MASK_INTERRUPTS_ENABLED|MASK_NOT_ISR,"NKern::FSSignal(NFastSemaphore*)"); |
511 } |
514 } |
512 |
515 |
513 |
516 |
514 /** Atomically signals a fast semaphore and releases a fast mutex. |
517 /** Atomically signals a fast semaphore and releases a fast mutex. |
515 |
518 |
522 |
525 |
523 @see NKern::FMSignal() |
526 @see NKern::FMSignal() |
524 */ |
527 */ |
525 EXPORT_C void NKern::FSSignal(NFastSemaphore* aSem, NFastMutex* aMutex) |
528 EXPORT_C void NKern::FSSignal(NFastSemaphore* aSem, NFastMutex* aMutex) |
526 { |
529 { |
|
530 CHECK_PRECONDITIONS(MASK_INTERRUPTS_ENABLED|MASK_NOT_ISR,"NKern::FSSignal(NFastSemaphore*, NFastMutex*)"); |
527 if (!aMutex) |
531 if (!aMutex) |
528 aMutex=&TheScheduler.iLock; |
532 aMutex=&TheScheduler.iLock; |
529 __KTRACE_OPT(KNKERN,DEBUGPRINT("NKern::FSSignal %m +FM %M",aSem,aMutex)); |
533 __KTRACE_OPT(KNKERN,DEBUGPRINT("NKern::FSSignal %m +FM %M",aSem,aMutex)); |
530 NKern::Lock(); |
534 NKern::Lock(); |
531 aSem->Signal(); |
535 aSem->Signal(); |
532 aMutex->Signal(); |
536 aMutex->Signal(); |
533 NKern::Unlock(); |
537 NKern::Unlock(); |
|
538 CHECK_PRECONDITIONS(MASK_INTERRUPTS_ENABLED|MASK_NOT_ISR,"NKern::FSSignal(NFastSemaphore*, NFastMutex*)"); |
534 } |
539 } |
535 |
540 |
536 |
541 |
537 /** Signals a fast semaphore multiple times. |
542 /** Signals a fast semaphore multiple times. |
538 |
543 |
553 CHECK_PRECONDITIONS(MASK_INTERRUPTS_ENABLED|MASK_NOT_ISR,"NKern::FSSignalN(NFastSemaphore*, TInt)"); |
558 CHECK_PRECONDITIONS(MASK_INTERRUPTS_ENABLED|MASK_NOT_ISR,"NKern::FSSignalN(NFastSemaphore*, TInt)"); |
554 __KTRACE_OPT(KNKERN,DEBUGPRINT("NKern::FSSignalN %m %d",aSem,aCount)); |
559 __KTRACE_OPT(KNKERN,DEBUGPRINT("NKern::FSSignalN %m %d",aSem,aCount)); |
555 NKern::Lock(); |
560 NKern::Lock(); |
556 aSem->SignalN(aCount); |
561 aSem->SignalN(aCount); |
557 NKern::Unlock(); |
562 NKern::Unlock(); |
|
563 CHECK_PRECONDITIONS(MASK_INTERRUPTS_ENABLED|MASK_NOT_ISR,"NKern::FSSignalN(NFastSemaphore*, TInt)"); |
558 } |
564 } |
559 |
565 |
560 |
566 |
561 /** Atomically signals a fast semaphore multiple times and releases a fast mutex. |
567 /** Atomically signals a fast semaphore multiple times and releases a fast mutex. |
562 |
568 |
570 |
576 |
571 @see NKern::FMSignal() |
577 @see NKern::FMSignal() |
572 */ |
578 */ |
573 EXPORT_C void NKern::FSSignalN(NFastSemaphore* aSem, TInt aCount, NFastMutex* aMutex) |
579 EXPORT_C void NKern::FSSignalN(NFastSemaphore* aSem, TInt aCount, NFastMutex* aMutex) |
574 { |
580 { |
|
581 CHECK_PRECONDITIONS(MASK_INTERRUPTS_ENABLED|MASK_NOT_ISR,"NKern::FSSignalN(NFastSemaphore*, TInt, NFastMutex*)"); |
575 if (!aMutex) |
582 if (!aMutex) |
576 aMutex=&TheScheduler.iLock; |
583 aMutex=&TheScheduler.iLock; |
577 __KTRACE_OPT(KNKERN,DEBUGPRINT("NKern::FSSignalN %m %d + FM %M",aSem,aCount,aMutex)); |
584 __KTRACE_OPT(KNKERN,DEBUGPRINT("NKern::FSSignalN %m %d + FM %M",aSem,aCount,aMutex)); |
578 NKern::Lock(); |
585 NKern::Lock(); |
579 aSem->SignalN(aCount); |
586 aSem->SignalN(aCount); |
580 aMutex->Signal(); |
587 aMutex->Signal(); |
581 NKern::Unlock(); |
588 NKern::Unlock(); |
|
589 CHECK_PRECONDITIONS(MASK_INTERRUPTS_ENABLED|MASK_NOT_ISR,"NKern::FSSignalN(NFastSemaphore*, TInt, NFastMutex*)"); |
582 } |
590 } |
583 |
591 |
584 |
592 |
585 /****************************************************************************** |
593 /****************************************************************************** |
586 * Thread |
594 * Thread |