diff --git a/src/libsysprof-profile/sysprof-recording-private.h b/src/libsysprof-profile/sysprof-recording-private.h index f09ed11a..ed5580dc 100644 --- a/src/libsysprof-profile/sysprof-recording-private.h +++ b/src/libsysprof-profile/sysprof-recording-private.h @@ -24,6 +24,7 @@ G_BEGIN_DECLS -SysprofRecording *_sysprof_recording_new (void); +SysprofRecording *_sysprof_recording_new (SysprofCaptureWriter *writer); +SysprofCaptureWriter *_sysprof_recording_writer (SysprofRecording *self); G_END_DECLS diff --git a/src/libsysprof-profile/sysprof-recording.c b/src/libsysprof-profile/sysprof-recording.c index 676edaa2..49cd0bf2 100644 --- a/src/libsysprof-profile/sysprof-recording.c +++ b/src/libsysprof-profile/sysprof-recording.c @@ -36,9 +36,20 @@ struct _SysprofRecording { GObject parent_instance; - SysprofRecordingState state : 3; + /* This is where all of the instruments will write to. They are + * expected to do this from the main-thread only. To work from + * additional threads they need to proxy that state to the + * main thread for writing. + */ + SysprofCaptureWriter *writer; + /* Waiters contains a list of GTask to complete calls to the + * sysprof_recording_wait_async() flow. + */ GQueue waiters; + + /* Our current state of operation */ + SysprofRecordingState state : 3; }; enum { @@ -135,9 +146,16 @@ sysprof_recording_init (SysprofRecording *self) } SysprofRecording * -_sysprof_recording_new (void) +_sysprof_recording_new (SysprofCaptureWriter *writer) { - return g_object_new (SYSPROF_TYPE_RECORDING, NULL); + SysprofRecording *self; + + g_return_val_if_fail (writer != NULL, NULL); + + self = g_object_new (SYSPROF_TYPE_RECORDING, NULL); + self->writer = sysprof_capture_writer_ref (writer); + + return self; } void