~alan-griffiths/mir/cleanup-some-locking

« back to all changes in this revision

Viewing changes to src/client/mir_surface.cpp

  • Committer: Alan Griffiths
  • Date: 2014-01-06 12:41:16 UTC
  • Revision ID: alan@octopull.co.uk-20140106124116-nrlde4625pqg9pme
Don't lock mutex in MirSurface::release_cpu_region() - it is a private function called with lock already held

Show diffs side-by-side

added added

removed removed

Lines of Context:
64
64
 
65
65
MirSurface::~MirSurface()
66
66
{
 
67
    std::lock_guard<decltype(mutex)> lock(mutex);
 
68
 
 
69
    if (input_thread)
67
70
    {
68
 
        std::lock_guard<decltype(mutex)> lock(mutex);
69
 
 
70
 
        if (input_thread)
71
 
        {
72
 
            input_thread->stop();
73
 
            input_thread->join();
74
 
        }
75
 
 
76
 
        for (auto i = 0, end = surface.fd_size(); i != end; ++i)
77
 
            close(surface.fd(i));
 
71
        input_thread->stop();
 
72
        input_thread->join();
78
73
    }
79
74
 
 
75
    for (auto i = 0, end = surface.fd_size(); i != end; ++i)
 
76
        close(surface.fd(i));
 
77
 
80
78
    release_cpu_region();
81
79
}
82
80
 
134
132
 
135
133
void MirSurface::release_cpu_region()
136
134
{
137
 
    std::lock_guard<decltype(mutex)> lock(mutex);
138
 
 
139
135
    secured_region.reset();
140
136
}
141
137
 
142
138
MirWaitHandle* MirSurface::next_buffer(mir_surface_callback callback, void * context)
143
139
{
 
140
    std::lock_guard<decltype(mutex)> lock(mutex);
 
141
 
144
142
    release_cpu_region();
145
143
 
146
144
    server.next_buffer(