Closed Bug 733758 Opened 9 years ago Closed 9 years ago

Inspecting the value of a CDataFinalizer without calling forget

Categories

(Core :: js-ctypes, enhancement)

enhancement
Not set
normal

Tracking

()

RESOLVED WONTFIX

People

(Reporter: Yoric, Assigned: Yoric)

References

Details

Attachments

(2 files)

At the moment, CDataFinalizer will not let code inspect the value held without calling |forget|. I have come across at least one case blocked by this: extracting the value from the finalizer to send it to a worker thread.

Just as Scoped pointers have a method |get|, we should have a method |value| to extract the value without calling |forget|.
Attachment #603717 - Flags: feedback?(jorendorff)
Comment on attachment 603717 [details] [diff] [review]
Implementation of attribute |value|

Looks like the right idea.

In the test, I think this line is wrong because it assumes GC did not run:
>+  do_check_eq(count_finalized(size, tc), 0);
Attachment #603717 - Flags: feedback?(jorendorff) → feedback+
Thanks for the feedback.

Taras has managed to convince me that I should try and implement OS.File without using this, so I am not going to push that patch much forward for the moment.
Turns out that we can simply cast a CDataFinalizer to its type using ctypes.cast, so this feature is useless.
Severity: normal → enhancement
Status: NEW → RESOLVED
Closed: 9 years ago
OS: Mac OS X → All
Hardware: x86 → All
Resolution: --- → WONTFIX
You need to log in before you can comment on or make changes to this bug.