kernel/eka/euser/us_ksvr.cpp
changeset 102 ef2a444a7410
parent 33 0173bcd7697c
child 109 b3a1d9898418
equal deleted inserted replaced
90:947f0dc9f7a8 102:ef2a444a7410
  3467 
  3467 
  3468 NOTE - TThreadCreateInfo::SetCreateHeap() or TThreadCreateInfo::SetUseHeap() must
  3468 NOTE - TThreadCreateInfo::SetCreateHeap() or TThreadCreateInfo::SetUseHeap() must
  3469 be invoked on this TThreadCreateInfo to set the type of the thread to be created
  3469 be invoked on this TThreadCreateInfo to set the type of the thread to be created
  3470 before being passed as a paramter to RThread::Create().
  3470 before being passed as a paramter to RThread::Create().
  3471 
  3471 
  3472 @param aName        The name to be assigned to the thread.
  3472 @param aName		The name to be assigned to the thread.
  3473 					KNullDesC, to create an anonymous thread.
  3473 					KNullDesC, to create an anonymous thread.
  3474 @param aFunction    A pointer to a function. Control passes to this function
  3474 @param aFunction	A pointer to a function. Control passes to this function
  3475                     when the thread is first resumed, i.e. when the thread
  3475 					when the thread is first resumed, i.e. when the thread
  3476                     is initially scheduled to run.
  3476 					is initially scheduled to run.
  3477 @param aStackSize   The size of the new thread's stack.
  3477 @param aStackSize	The size of the new thread's stack.  This must be at least
  3478 @param aPtr         A pointer to data to be passed as a parameter to
  3478 					512 bytes, otherwise RThread::Create() will fail with KErrArgument.
  3479                     the thread function when the thread is initially scheduled
  3479 @param aPtr			A pointer to data to be passed as a parameter to
  3480                     to run. If the thread function does not need any data then
  3480 					the thread function when the thread is initially scheduled
  3481                     this pointer can be NULL.
  3481 					to run. If the thread function does not need any data then
       
  3482 					this pointer can be NULL.
  3482 */
  3483 */
  3483 EXPORT_C TThreadCreateInfo::TThreadCreateInfo(const TDesC &aName, TThreadFunction aFunction, 
  3484 EXPORT_C TThreadCreateInfo::TThreadCreateInfo(const TDesC &aName, TThreadFunction aFunction, 
  3484 											TInt aStackSize, TAny* aPtr) :
  3485 											TInt aStackSize, TAny* aPtr) :
  3485 	iVersionNumber(EVersion0), iName(&aName), iFunction(aFunction), 
  3486 	iVersionNumber(EVersion0), iName(&aName), iFunction(aFunction), 
  3486 	iStackSize(aStackSize),	iParameter(aPtr), iOwner(EOwnerProcess), iHeap(NULL), 
  3487 	iStackSize(aStackSize),	iParameter(aPtr), iOwner(EOwnerProcess), iHeap(NULL), 
  3602 the second parameter to this function.
  3603 the second parameter to this function.
  3603 
  3604 
  3604 If KNullDesC is specified for the name, then an anonymous thread will be created.
  3605 If KNullDesC is specified for the name, then an anonymous thread will be created.
  3605 Anonymous threads are not global, and cannot be opened by other processes.
  3606 Anonymous threads are not global, and cannot be opened by other processes.
  3606 
  3607 
  3607 @param aName        The name to be assigned to this thread.
  3608 @param aName		The name to be assigned to this thread.
  3608 					KNullDesC, to create an anonymous thread.
  3609 					KNullDesC, to create an anonymous thread.
  3609 @param aFunction    A pointer to a function.. Control passes to this function
  3610 @param aFunction	A pointer to a function.. Control passes to this function
  3610                     when the thread is first resumed, i.e. when the thread
  3611 					when the thread is first resumed, i.e. when the thread
  3611                     is initially scheduled to run.
  3612 					is initially scheduled to run.
  3612 @param aStackSize   The size of the new thread's stack.
  3613 @param aStackSize	The size of the new thread's stack.  This must be at least
       
  3614 					512 bytes, otherwise this method will fail with KErrArgument.
  3613 @param aHeapMinSize The minimum size for the new thread's heap.
  3615 @param aHeapMinSize The minimum size for the new thread's heap.
  3614 @param aHeapMaxSize The maximum size for the new thread's heap.
  3616 @param aHeapMaxSize The maximum size for the new thread's heap.
  3615 @param aPtr         A pointer to data to be passed as a parameter to
  3617 @param aPtr			A pointer to data to be passed as a parameter to
  3616                     the thread function when the thread is initially scheduled
  3618 					the thread function when the thread is initially scheduled
  3617                     to run. If the thread function does not need any data then
  3619 					to run. If the thread function does not need any data then
  3618                     this pointer can be NULL. It must be ensured that the memory 
  3620 					this pointer can be NULL. It must be ensured that the memory 
  3619                     pointed to by this pointer is still valid when accessed by 
  3621 					pointed to by this pointer is still valid when accessed by 
  3620                     the new thread, e.g. if aPtr points to data on the stack.
  3622 					the new thread, e.g. if aPtr points to data on the stack.
  3621 @param aType        An enumeration whose enumerators define the ownership of
  3623 @param aType		An enumeration whose enumerators define the ownership of
  3622                     this thread handle. If not explicitly specified,
  3624 					this thread handle. If not explicitly specified,
  3623                     EOwnerProcess is taken as default.
  3625 					EOwnerProcess is taken as default.
  3624 
  3626 
  3625 @return KErrNone if successful, otherwise one of the other system-wide error codes.
  3627 @return KErrNone if successful, otherwise one of the other system-wide error codes.
       
  3628 		KErrArgument if aStackSize is less than 512 bytes.
  3626         KErrAlreadyExists will be returned if there is another thread in this process with the
  3629         KErrAlreadyExists will be returned if there is another thread in this process with the
  3627         specified name.
  3630         specified name.
  3628 
  3631 
  3629 @panic USER 109 if aStackSize is negative.
  3632 @panic USER 109 if aStackSize is negative.
  3630 @panic USER 110 if aHeapMinSize is less than KMinHeapSize.
  3633 @panic USER 110 if aHeapMinSize is less than KMinHeapSize.
  3631 @panic USER 111 if aHeapMaxSize is less than aHeapMinSize.
  3634 @panic USER 111 if aHeapMaxSize is less than aHeapMinSize.
  3632 */
  3635 */
  3633 	{
  3636 	{// This must be true otherwise the comment on aStackSize will be incorrect and BC 
       
  3637 	// break will occur.  See ExecHandler::ThreadCreate() for details.
       
  3638 	__ASSERT_COMPILE(KMaxThreadCreateInfo == 256);
       
  3639 
  3634 	TThreadCreateInfo createInfo(aName, aFunction, aStackSize, aPtr);
  3640 	TThreadCreateInfo createInfo(aName, aFunction, aStackSize, aPtr);
  3635 	createInfo.SetOwner(aType);
  3641 	createInfo.SetOwner(aType);
  3636 	createInfo.SetCreateHeap(aHeapMinSize, aHeapMaxSize);
  3642 	createInfo.SetCreateHeap(aHeapMinSize, aHeapMaxSize);
  3637 	return Create(createInfo);
  3643 	return Create(createInfo);
  3638 	}
  3644 	}
  3653 parameter to this function.
  3659 parameter to this function.
  3654 
  3660 
  3655 If KNullDesC is specified for the name, then an anonymous thread will be created.
  3661 If KNullDesC is specified for the name, then an anonymous thread will be created.
  3656 Anonymous threads are not global, and cannot be opened by other processes.
  3662 Anonymous threads are not global, and cannot be opened by other processes.
  3657 
  3663 
  3658 @param aName      The name to be assigned to this thread.
  3664 @param aName		The name to be assigned to this thread.
  3659 				  KNullDesC, to create an anonymous thread.
  3665 					KNullDesC, to create an anonymous thread.
  3660 @param aFunction  A pointer to a function. Control passes to this function when 
  3666 @param aFunction	A pointer to a function. Control passes to this function when 
  3661 	              the thread is first resumed, i.e. when the thread is
  3667 					the thread is first resumed, i.e. when the thread is
  3662 	              initially scheduled to run.
  3668 					initially scheduled to run.
  3663 @param aStackSize The size of the new thread's stack.
  3669 @param aStackSize	The size of the new thread's stack.  This must be at least
  3664 @param aAllocator A pointer to the handle of the heap belonging to another thread 
  3670 					512 bytes, otherwise this method will fail with KErrArgument.
  3665                   which this thread is to use.
  3671 @param aAllocator	A pointer to the handle of the heap belonging to another thread 
  3666 @param aPtr       A pointer to data to be passed as a parameter to the thread
  3672 					which this thread is to use.
  3667                   function when the thread is initially scheduled to run.
  3673 @param aPtr			A pointer to data to be passed as a parameter to the thread
  3668                   If the thread function does not need any data,
  3674 					function when the thread is initially scheduled to run.
  3669                   then this pointer can be NULL. It must be ensured that the 
  3675 					If the thread function does not need any data,
  3670                   memory pointed to by this pointer is still valid when accessed 
  3676 					then this pointer can be NULL. It must be ensured that the 
  3671                   by the new thread, e.g. if aPtr points to data on the stack.
  3677 					memory pointed to by this pointer is still valid when accessed 
  3672 @param aType      An enumeration whose enumerators define the ownership of this 
  3678 					by the new thread, e.g. if aPtr points to data on the stack.
  3673                   thread handle. If not explicitly specified, EOwnerProcess is
  3679 @param aType		An enumeration whose enumerators define the ownership of this 
  3674                   taken as default.
  3680 					thread handle. If not explicitly specified, EOwnerProcess is
       
  3681 					taken as default.
  3675 
  3682 
  3676 @return KErrNone if successful otherwise one of the other system-wide error codes.
  3683 @return KErrNone if successful otherwise one of the other system-wide error codes.
       
  3684 		KErrArgument if aStackSize is less than 512 bytes.
  3677         KErrAlreadyExists will be returned if there is another thread in this process with the
  3685         KErrAlreadyExists will be returned if there is another thread in this process with the
  3678         specified name.
  3686         specified name.
  3679 
  3687 
  3680 @panic USER 109 if aStackSize is negative.
  3688 @panic USER 109 if aStackSize is negative.
  3681 */
  3689 */