| 757 | } |
| 758 | |
| 759 | void MPIOffloadDevice::release(OSPObject _object) |
| 760 | { |
| 761 | const ObjectHandle handle = (const ObjectHandle &)_object; |
| 762 | |
| 763 | appRefCount[handle.i64]--; |
| 764 | // If the app still has references to the object there's no need to |
| 765 | // cleanup or send a release command |
| 766 | if (appRefCount[handle.i64] > 0) { |
| 767 | return; |
| 768 | } |
| 769 | |
| 770 | if (futures.find(handle.i64) != futures.end()) { |
| 771 | wait((OSPFuture)_object, OSP_TASK_FINISHED); |
| 772 | futures.erase(handle.i64); |
| 773 | } |
| 774 | |
| 775 | sendWork( |
| 776 | [&](networking::WriteStream &writer) { |
| 777 | writer << work::RELEASE << handle.i64; |
| 778 | }, |
| 779 | false); |
| 780 | |
| 781 | // If this object was sharing a data view with the application we need to |
| 782 | // make sure the data has been transferred before letting the application |
| 783 | // potentially release the buffer. We only need to flush any early data |
| 784 | // sends here, since if the data was small enough to inline in the command |
| 785 | // buffer we aren't actually sharing the pointer with the app anymore |
| 786 | auto d = sharedData.find(handle.i64); |
| 787 | if (d != sharedData.end()) { |
| 788 | // Make sure there's no pending send referencing this data if we're going |
| 789 | // to delete it |
| 790 | if (d->second.releaseHazard) { |
| 791 | postStatusMsg(OSP_LOG_DEBUG) |
| 792 | << "#osp.mpi.app: ospRelease: data reference hazard exists, " |
| 793 | << " flushing pending sends"; |
| 794 | fabric->flushBcastSends(); |
| 795 | } |
| 796 | d->second.release(); |
| 797 | sharedData.erase(handle.i64); |
| 798 | } |
| 799 | } |
| 800 | |
| 801 | void MPIOffloadDevice::retain(OSPObject _obj) |
| 802 | { |
nothing calls this directly
no test coverage detected