From mboxrd@z Thu Jan 1 00:00:00 1970 Message-ID: <48B2E323.1060600@domain.hid> Date: Mon, 25 Aug 2008 18:51:47 +0200 From: Philippe Gerum MIME-Version: 1.0 References: <200808251743.26012@domain.hid> In-Reply-To: <200808251743.26012@domain.hid> Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Subject: Re: [Xenomai-help] rt_queue_delete returns -EBUSY Reply-To: rpm@xenomai.org List-Id: Help regarding installation and common use of Xenomai List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Petr Cervenka Cc: xenomai@xenomai.org Petr Cervenka wrote: > Hello, > I tried xenomai 2.4.5, hoping that my problems with real-time queue will disappear. But there is another (perhaps very trivial) error. > Function call rt_queue_delete always returns -EBUSY (at least for me). You don't have to bind it from another task or use it at all. > I hope that I have used it in the right way. Actually, if your code still creates and deletes queues dynamically during the normal operations, this is clearly not the best approach. Those calls are VERY costly, and very much prone to unbounded latency. I.e. They switch to secondary mode, allocate/deallocate ranges of kernel memory, create/delete internal Xenomai heap objects, and eventually map/unmap those memory ranges to/from your user-space process. > Petr Cervenka > > Simple example: > > #include > > #include // mlockall > #include > #include > > RT_TASK main_task; > RT_QUEUE queue; > > int main(int argc, char** argv) { > int res; > > mlockall(MCL_CURRENT | MCL_FUTURE); > > res = rt_task_shadow(&main_task, "MAIN_TASK", 5, T_FPU); > if (res < 0) { > fprintf(stderr, "rt_task_shadow() failed: %d (%s)\n", res, strerror(-res)); > goto cleanup_end; > } > > res = rt_queue_create(&queue, "QUEUE", 1024, Q_UNLIMITED, Q_FIFO | Q_SHARED); > if (res < 0) { > fprintf(stderr, "rt_queue_create() failed: %d (%s)\n", res, strerror(-res)); > goto cleanup_task; > } > > cleanup_queue: > res = rt_queue_delete(&queue); > if (res < 0) { > fprintf(stderr, "rt_queue_delete() failed: %d (%s)\n", res, strerror(-res)); > } > cleanup_task: > cleanup_end: > return res; > } > > > _______________________________________________ > Xenomai-help mailing list > Xenomai-help@domain.hid > https://mail.gna.org/listinfo/xenomai-help > -- Philippe.