From: P Mehta ([email protected])
Date: Mon Jun 21 2004 - 10:20:53 PDT
Hello, Another implementation based question for UPC. I am trying to build a simple queue that can be shared among threads, but I'm running into some issues. The queue is a structure of (for simplicity) one pointer to a (possible shared) array of integers, and three other integers. I want to be able to allocate the structure dynamically in one thread, and have it accessible by all threads later. From what I understand (and please correct me if I'm wrong), this would require a upc_global_alloc call and that a shared pointer-to-shared (ie. shared struct queue *shared). Unfortunately there are a number of complications that I cannot seem to resolve. For example, in this case, should the pointer within the structure be a pointer to shared, or is the sharing resolved by making the pointer to the structure a shared pointer? I've found that I can only make the pointer a shared variable, and I am not allowed to make the other three integers 'shared int's. Additionally, I've found that to create a shared pointer-to-shared, the declaration must be made statically. Is this the case; am I limited to static declarations? Also, are there some pointer declaration cases in which one of the allocation functions will work and another will not? For example, is there a case where the allocation must be a upc_all_alloc, and making an analogous (eg. single thread) upc_global_alloc will not work? Thanks, Paras Mehta