l4-hurd
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Task server thread and task allocation/deallocation interfaces propo


From: Matthieu Lemerre
Subject: Re: Task server thread and task allocation/deallocation interfaces proposal
Date: Tue, 08 Mar 2005 01:09:16 +0000
User-agent: Gnus/5.11 (Gnus v5.11) Emacs/22.0.50 (gnu/linux)

Hi,

*I finally wrote the following client stubs for the task server:


/* Request allocation of NUM threads.  Threads are created with pager
   PAGER.  If FLAG | TASK_NEW, operation happens on a new task, whose
   handle is returned in RETURN_HANDLE.  If KIP_BASE or UTCB is
   non-null, it is used for the next space_control on the address
   space (which happens when the number of threads in a task goes from
   0 to 1).  After the call, RETURN_HANDLE contains the task handle
   where threads were allocated, NUM_ALLOCATED_THREADS the number of
   allocated threads, and ALLOCATED_THREAD_IDS is filled with the
   allocated thread ids.  */
error_t
task_allocate_threads (l4_thread_id_t task_server,
                       hurd_cap_handle_t task,
                       l4_word_t num,
                       l4_thread_id_t pager,
                       void *kip_base,
                       l4_fpage_t utcb,
                       l4_word_t flag,
                       hurd_cap_handle_t *return_handle,
                       l4_word_t *num_allocated_threads,
                       l4_word_t *allocated_threads_ids)


/* Request deallocation of NUM threads.  THREAD_IDS is an array
   containing the thread ids of the threads to deallocate.  NUM can be
   0, in which case THREAD_IDS is ignored and all threads are
   deallocated (this also destroys the address space).  After the
   call, NUM_DEALLOCATED_THREADS contains the number of deallocated
   threads. If not all threads were deallocated, ERROR contains the
   reason why the NUMth thread was not deallocated, else 0.  */
error_t
task_deallocate_threads (l4_thread_id_t task_server,
                         hurd_cap_handle_t task,
                         l4_word_t num,
                         l4_thread_id_t *thread_ids,
                         l4_word_t *num_deallocated_threads,
                         error_t *error);


/* Terminate the task TASK, releasing all associated ressources
   associated with it.  */
error_t
task_terminate (l4_thread_id_t task_server,
                hurd_cap_handle_t task);



*I can maybe write some wrapper functions for common-case calls to 
task_allocate_thread:

/* Create an empty task control capability.  */
error_t
task_create_empty (l4_thread_id_t task_server,
                   hurd_cap_handle_t task,
                   hurd_cap_handle_t *new_task)

/* Create a task with one thread.  */
error_t
task_create_task (l4_thread_id_t task_server,
                  hurd_cap_handle_t task,
                  hurd_cap_handle_t *new_task,
                  l4_thread_id_t *thread_id);

/* Allocate NUM threads for the task.  */
error_t
task_thread_alloc (l4_thread_id_t task_server,
                   hurd_cap_handle_t task,
                   l4_word_t *num_allocated_threads,
                   l4_word_t *allocated_threads_ids)


*I did not write the revoke-and-reparent operation, but I think that it will be 
like that:

/* Reparent the current task.  All threads in that task are destroyed.  */
error_t
task_reparent(l4_thread_id_t task_server,
              hurd_cap_handle_t task,
              hurd_cap_handle_t new_parent);

I'm implementing the missing parts while waiting for your comments.

Many thanks,
Matthieu




reply via email to

[Prev in Thread] Current Thread [Next in Thread]